Axel CABLE axel.cable at etu.univ-nantes.fr
Mon Aug 4 08:47:38 MDT 2008

Thank you for your answer Chris,

So using the modified BlockKrylovSchurEx.cpp example, I asked to search
for only one eigenvalue (the one of largest magnitude).

evecs->Print(std::cout) gave me one eigenvector, which should be the one
corresponding to the largest eigenvalue.

Though, the eigenvector is large and I would like to get it in an output
file: out.txt for example.

I tried to do:

std::ofstream output("out.txt");

output << "# eigenvector: " << std::endl;
output << evecs->Print(std::cout) << std::endl;

But it did not work. As suggested in the error message, I tried using 
std::basic_ostream , but did not get anything working either.

Would you have any idea?

Thanks in advance!

> Axel,
> There are two things that should be addressed in the code example below.
> The first is that the variable evecs is a RefCountPtr to the multivector
> containing the eigenvectors, so that outputting it will only output
> information regarding the pointer. Typically, given a RCP<MV>, the way to
> print it is to use Anasazi's multivector traits mechanism, like so:
> MultiVecTraits<MV>::MvPrint(*evecs);
> or to use the native print capability of the underlying multivector. For
> an Epetra_MultiVector (as in BlockKrylovSchurEx.cpp), this is done via:
> evecs->Print(std::cout)
> The second issue is that for a non-symmetric eigenvalue problem, the
> eigenvectors in evecs are stored in a compressed form. This storage scheme
> exploits the redundancy in the eigenvectors (due to the occurance of
> eigenvectors in complex conjugate pairs) in order to reduce the storage
> requirements. Extracting a complex eigenvector requires using the index in
> sol.index to locate the real and imaginary components of the desired
> eigenvector in sol.Evecs. An example of how to do this is in the
> BlockKrylovSchurEx.cpp you used to build your test. Documentation on this
> storage scheme is located at
> http://trilinos.sandia.gov/packages/docs/r8.0/packages/anasazi/doc/html/structAnasazi_1_1Eigensolution.html#o3
> Cheers,
> Chris
> On Wed, Jul 30, 2008 at 06:32, Axel CABLE <axel.cable at etu.univ-nantes.fr>
> wrote:
>     Dear list,
>     I want to get the largest eigenvalue and corresponding eigenvector of
> a
>     real large sparse non-symmetric matrix.
>     I modified the Anasazi BlockKrylovSchurEx example, building my own
> matrix.
>     The example does give the eigenvalues but I cant get it to give the
>     eigenvectors:
>     I figured
>      Teuchos::RCP<MV> evecs = sol.Evecs;
>      std::vector<int> index = sol.index;
>     and cout << "Eigenvectors" << evecs <<endl;
>     would be enough, but I am clearly missing something here.
>     Would you have an idea how to get it to output the eigenvectors? (or
> at
>     least the one associated with the largest eigenvalue)
>     Thanks in advance!
>     Axel
>     _______________________________________________
>     Trilinos-Users mailing list
>     Trilinos-Users at software.sandia.gov
>     http://software.sandia.gov/mailman/listinfo/trilinos-users

More information about the Trilinos-Users mailing list