[Trilinos-Users] [EXTERNAL] Anasazi problem

Thornquist, Heidi K hkthorn at sandia.gov
Thu Mar 21 09:45:26 MDT 2013


Hi Sunghwan,

Thanks for sending the code snippet.  So, my first question is what is the initial_eigenvector?  It may be set to something, but don't see it declared in your code example.
In general, that vector is often set to have random entries and it cannot be Teuchos::null or the call to setProblem() will not successfully complete.   For example:

  // Create an Epetra_MultiVector for an initial vector to start the solver.
  // Note:  This needs to have the same number of columns as the blocksize.
  Teuchos::RCP<Epetra_MultiVector> ivec = Teuchos::rcp( new Epetra_MultiVector(Map, blockSize) );
  ivec->Random();

  // Create the eigenproblem.
  Teuchos::RCP<Anasazi::BasicEigenproblem<double, MV, OP> > MyProblem =
    Teuchos::rcp( new Anasazi::BasicEigenproblem<double, MV, OP>() );

  // Inform the eigenproblem that the operator A is symmetric
  MyProblem->setHermitian(true);

  // Set the number of eigenvalues requested
  MyProblem->setNEV( 5 );

  // Set the operator and initial vector
  MyProblem->setOperator( matrix );
  MyProblem->setInitVec( ivec );

  // Inform the eigenproblem that you are finishing passing it information
  bool ret = MyProblem->setProblem();
  if (ret != true) {
      std::cout << "Anasazi::BasicEigenproblem::setProblem() returned with error." << std::endl;
  }

Also, when you call "setProblem" on the eigenproblem object check the return boolean which will indicate if there is any issue.  Given the error you are seeing from the
eigensolver, the issue is with the BasicEigenproblem object.

Thanks,
Heidi


________________________________
From: trilinos-users-bounces at software.sandia.gov [trilinos-users-bounces at software.sandia.gov] on behalf of SungHwan Choi [sunghwanchoi91 at gmail.com]
Sent: Wednesday, March 20, 2013 6:57 PM
To: trilinos-users at software.sandia.gov
Subject: [EXTERNAL] [Trilinos-Users] Anasazi problem

I have question;;;
I think I have no problem and actually I used this codes before,,,,, after I used Teuchos::Array It doesn't work;;;  please let me know the solution here is pseudo code;



Teuchos::Array<Teuchos::RCP <Epetra_CrsMatrix > > crs_array ;
for (int i =0;i<2;i++){

       crs_array.push_back(Teuchos::rcp(new Epetra_CrsMatrix(copy,map,0)) );
}

functionA(crs_array[0]);



int functionA(Teuchos::RCP<Epetra_CrsMatrix> matrix )
    cout << *matrix << endl;   //Epetra_CrsMatrix is printed well

    Teuchos::RCP < Anasazi::BasicEigenproblem<double,MV,OP> > MyProblem =Teuchos::rcp( new Anasazi::BasicEigenproblem<double,MV,OP>() );
    MyProblem->setNEV( 5);
    MyProblem->setHermitian(true);
    MyProblem->setOperator(matrix);
    MyProblem->setInitVec(initial_eigenvector);
    MyProblem->setProblem();

    Teuchos::ParameterList MyPL;
    MyPL.set( "Verbosity", verb );
    MyPL.set( "Which", "SR" );
    MyPL.set( "Block Size", 20);
    MyPL.set( "Num Blocks", 24);


    Anasazi::BlockKrylovSchurSolMgr<double,MV,OP> MyBlockKrylovSchur(MyProblem, MyPL );
    cout <<"111111111111111" <<endl;  //it is not printed
    Anasazi::ReturnType solverreturn = MyBlockKrylovSchur.solve();

terminate called after throwing an instance of 'std::invalid_argument'
  what():  /appl/trilinos/libs/include/AnasaziBlockKrylovSchurSolMgr.hpp:266:
Throw number = 1
Throw test that evaluated to true: !_problem->isProblemSet()


I already spent more than a day';;;  please what is the problem and the solution
Sunghwan Choi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20130321/7be37e79/attachment.html 


More information about the Trilinos-Users mailing list