[Trilinos-Users] Beginner's problems with PyTrilinos and Anasazi
Marko Budisic
mbudisic at engineering.ucsb.edu
Mon Dec 15 21:37:27 MST 2008
Dear Trilinos list,
I would like to use PyTrilinos with Anasazi to compute eigenvectors of
large non-symmetric sparse matrices. In order to familiarize myself with
both packages, I tried to build a small example for computing
1-eigenvector of a probability transition matrix for a random walk on a
graph. The solver I tried to use was BlockKrylovSchur.
I managed to successfuly build the matrix in question and even perform
some basic operations on it (I checked by printing the matrix). I also
managed to pass the setProblem() sanity test with the Eigenproblem
object. However, when I try to invoke the solver, the GEES subroutine
fails which causes the entire code to fail.
This is the traceback from Python:
******************
Traceback (most recent call last):
File "src/anasazitest.py", line 56, in <module>
info = mngr.solve()
File "/usr/lib/python2.5/site-packages/PyTrilinos/Anasazi.py", line
6456, in solve
return _Anasazi.BlockKrylovSchurSolMgrEpetra_solve(*args)
SystemError: /home/mbudisic/downloads/trilinos-9.0.1/packages/anasazi/src/AnasaziBlockKrylovSchur.hpp:1432:
Throw number = 1
Throw test that evaluated to true: info != 0
Anasazi::BlockKrylovSchur::computeSchurForm(): GEES returned info != 0.
*******************
I am guessing that I am mismatching some options, possibly related to
block size and sizes of auxiliary vectors but I don't know how to
correct the problem. Below is the relevant source code.
If anyone could direct me in correcting this problem, I would be very
thankful. Also, if you have any other suggestions, based on my code,
those would also be very much appreciated.
Best,
Marko Budisic
*********************************
# epetra
nx = 5
numglobals = nx*nx
mycomm = Epetra.SerialComm()
mymap = Epetra.Map( numglobals, 0, mycomm )
W = Epetra.CrsMatrix(Epetra.Copy, mymap, 4)
# populate matrix
W.InsertGlobalValues( 0, [1.,2.,3.,2.], [0,1,2,4] )
W.InsertGlobalValues( 1, [1.,2.], [1,2] )
W.InsertGlobalValues( 2, [1.,2.], [2,3] )
W.InsertGlobalValues( 3, [3.,1.], [0,3] )
W.InsertGlobalValues( 4, [2.,1.], [3,4] )
W.FillComplete()
# normalize the matrix
d = Epetra.Vector( W.RowMap() )
W.InvRowSums(d)
W.LeftScale(d)
print W
eigs = Anasazi.BasicEigenproblem()
eigs.setA( W )
eigs.setHermitian(False)
Nev = 1
eigs.setNEV( Nev )
blocksize = 1
storage = Epetra.MultiVector( W.RowMap() , blocksize)
eigs.setInitVec(storage)
print "Problem set:", eigs.setProblem()
myPL = Teuchos.ParameterList()
myPL.set("Which", "LM")
myPL.set("Block Size",blocksize)
myPL.set("Verbosity", Anasazi.Errors | Anasazi.Warnings | \
Anasazi.FinalSummary )
mngr = Anasazi.BlockKrylovSchurSolMgr( eigs, myPL )
info = mngr.solve()
print "Problem solved:", info
x = eigs.getSolution()
print x.Evecs()
*********************************
More information about the Trilinos-Users
mailing list