← Back to team overview

dolfin team mailing list archive

Re: [FEniCS-users] eigenpair from python

 

On Friday 09 October 2009 12:23:06 Anders Logg wrote:
> On Fri, Oct 09, 2009 at 09:31:27AM +0200, Johan Hake wrote:
> > On Friday 09 October 2009 09:18:30 Johan Hake wrote:
> > > On Friday 09 October 2009 09:06:19 azumi.hayakawa@xxxxxxxxxxxxxxxxxxx 
wrote:
> > > > Hello list,
> > > >
> > > > I would like to use get_eigenpair function from within
> > > > python programmes.  The 1st thing I tried is modifying
> > > > demo/la/eigensolver/python/demo.py as follows:
> > > >     ---- original
> > > >     (lr, lc) = esolver.get_eigenvalue(i)
> > > >
> > > >     ---- modified
> > > >     r = PETScVector(A.size(0))
> > > >     c = PETScVector(A.size(0))
> > > >     esolver.get_eigenpair(lr, lc, r, c, i)
> > >
> > > There is a bug in the Python wrapper (thanks for noticing!).
> > >
> > > Try using
> > >
> > >    lr, lc = esolver.getEigenpair(r, c, i)
> > >
> > > if you are on stable. If you pull the latest code you will soon be able
> > > to use:
> > >
> > >    lr, lc = esolver.get_eigenpair(r, c, i)
> >
> > While at it shouldn't the PETScVectors also be return arguments? Leaving
> > us with:
> >
> >   r, c, lr, lc = esolver.get_eigenpair(i)
> 
> Yes, or rather
> 
>   lr, lc, r, c = esolver.get_eigenpair(i)
> 
> as in C++.

Yes, comming soon!

I added a private variable system_size that stored the size of the matrix, so 
one can check the size of the passed PETScVectors. SLEPc does not do this for 
us.
 
> We should also add get_eigenvector to just return r and c.

SLEPc does not come with this function. Isn't it natural to just have 
eigenvalues and eigenpairs, where the latter returns both values and vectors?

Johan

> --
> Anders
> 
> > Johan
> >
> > > Johan
> > >
> > > > This gave me an error below:
> > > > Traceback (most recent call last):
> > > >   File "./demo.py", line 46, in <module>
> > > >     esolver.get_eigenpair(lr, lc, r, c, i)
> > > >   TypeError: in method 'SLEPcEigenSolver_get_eigenpair', argument 2
> > > > of type 'double &'
> > > >
> > > > Could some one give some advice on how to use
> > > > get_eigenpair function?  Incidentally, cpp demo
> > > > ran without an error, and seemed to work fine.
> > > >
> > > > Thanks in advance,
> > > > -- Azumi Hayakawa
> > > > _______________________________________________
> > > > FEniCS-users mailing list
> > > > FEniCS-users@xxxxxxxxxx
> > > > http://fenics.org/mailman/listinfo/fenics-users
> > >
> > > _______________________________________________
> > > FEniCS-users mailing list
> > > FEniCS-users@xxxxxxxxxx
> > > http://fenics.org/mailman/listinfo/fenics-users
> >
> > _______________________________________________
> > DOLFIN-dev mailing list
> > DOLFIN-dev@xxxxxxxxxx
> > http://www.fenics.org/mailman/listinfo/dolfin-dev
> 


Follow ups

References