← Back to team overview

dolfin team mailing list archive

Re: [FEniCS-users] eigenpair from python

 

On Friday 09 October 2009 13:13:45 Anders Logg wrote:
> On Fri, Oct 09, 2009 at 12:32:41PM +0200, Johan Hake wrote:
> > 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?
> 
> I think it would be natural to have eigenvalues, eigenvectors and
> perhaps eigenpairs, but if it's not in SLEPc we don't need to add
> eigenvectors. Nice that you fixed it.

Ok, just some bugs that needs to be ironed out. Always run the test suit 
before pushing...

Johan

> --
> Anders
> 


References