[SciPy-dev] The future of the scipy.sandbox and a reminder of upcoming doc-day

Nathan Bell wnbell@gmail....
Thu Jan 24 07:16:54 CST 2008


On Jan 24, 2008 2:31 AM, Robert Cimrman <cimrman3@ntc.zcu.cz> wrote:

> Besides the sparse stuff, I would also like to have support for the
> symmetric eigenvalue functions of lapack that are currently in the
> symeig package, but are not in scipy.linalg. lobpcg needs them to work
> correctly.

We should formalize your idea to make a standard "dummy" matrix soon
also.  How about the name LinearOperator?  Our goal with this should
be to eliminate all of the code that checks for matvec(), psolve(),
etc.

I imagine a definition like so:

class LinearOperator:
    def __init__(self, shape, matvec, rmatvec=None,psolve=None):
        self.shape = shape
        self.matvec = matvec

        if rmatvec is not None:
            self.rmatvec
        else:
            def rmatvec(x):
                 raise NotImplementedError('LinearOperator does not
define the operation x*A")


A question arises when dealing with psolve() (the preconditioner).  We
could either continue checking for the existence of psolve() in each
method, or we could make LinearOperator have a dummy routine psolve(x)
-> x and then write the methods so that the preconditioner is always
applied.

The downside to this approach is that unnecessary copies may be
performed.  OTOH one could write the method to avoid such problems (at
worst, by checking to psolve() as is currently done).  Ideas?

-- 
Nathan Bell wnbell@gmail.com
http://graphics.cs.uiuc.edu/~wnbell/


More information about the Scipy-dev mailing list