void 
nmrSymmetricEigenProblem::Data::CheckSystem
( const vctDynamicMatrix<double>& A,
  const vctDynamicVector<double>& D,
  const vctDynamicMatrix<double>& V ){

  // test that number of rows match
  if( A.rows() != A.cols() ){
    std::ostringstream message;
    message << "nmrSymmetricEigenProblem: Matrix A has " << A.rows() << " rows "
	    << " and "  << A.cols() << " columns.";
    cmnThrow( std::runtime_error( message.str() ) );
  }

  // check for fortran format
  if( !A.IsFortran() ){
    std::string message( "nmrSymmetricEigenProblem: Invalid matrix A format." );
    cmnThrow( std::runtime_error( message ) );
  }

  // test that number of rows match
  if( V.rows() != A.rows() || V.cols() != A.cols() ){
    std::ostringstream message;
    message << "nmrSymmetricEigenProblem: Matrix V has " << V.rows() << " rows "
	    << " and "  << V.cols() << " columns.";
    cmnThrow( std::runtime_error( message.str() ) );
  }

  if( !V.IsFortran() ){
    std::string message( "nmrSymmetricEigenProblem: Invalid matrix V format." );
    cmnThrow( std::runtime_error( message ) );
  }

  if( D.size() != A.rows() ){
    std::ostringstream message;
    message << "nmrSymmetricEigenProblem: Vector D has " << D.size() << " rows";
    cmnThrow( std::runtime_error( message.str() ) );
  }

}
Esempio n. 2
0
void nmrLSMinNorm::Data::CheckSystem( const vctDynamicMatrix<double>& A,
                                      const vctDynamicMatrix<double>& b ) const{
  
  // test that number of rows match
  if( A.rows() != b.rows() ){
    std::ostringstream message;
    message << "nmrLSMinNorm: Matrix A has " << A.rows() << " rows. "
	    << "Matrix B has "  << b.rows() << " rows.";
    cmnThrow( std::runtime_error( message.str() ) );
  }

  // check for fortran format
  if( !( A.IsFortran() ) ){
    std::string message( "nmrLSMinNorm: Invalid matrix A format." );
    cmnThrow( std::runtime_error( message ) );
  }

  if( !( b.IsFortran() ) ){
    std::string message( "nmrLSMinNorm: Invalid matrix b format." );
    cmnThrow( std::runtime_error( message ) );
  }

}