[SciPy-dev] help: wrapping generalized symmetric evp functions

Nathan Bell wnbell@gmail....
Wed Apr 9 14:52:10 CDT 2008


On Tue, Apr 8, 2008 at 8:14 AM, Robert Cimrman <cimrman3@ntc.zcu.cz> wrote:
>  There could be even proper solver classes (LinearSolver,
>  EigenvalueSolver, etc.) with a common interface in each solver family.
>  Below, as an example, is the code we use in sfepy. As you can see, the
>  solver classes have only the __init__ method (can be used e.g. to
>  pre-factorize a matrix in the case of a linear solver) and the __call__
>  method (application of the solver). Would it be interesting to have
>  something in that spirit in scipy?
>
>  class Solver( Struct ):
>      def __init__( self, conf, **kwargs ):
>          Struct.__init__( self, conf = conf, **kwargs )
>      def __call__( self, **kwargs ):
>          print 'called an abstract Solver instance!'
>          raise ValueError
>
<snip>

Robert, I like the idea of having an abstract interface to the various
solvers/eigensolvers.  I'm currently battling with this in PyAMG for
various coarse-grid solvers and relaxation methods.

We should definitely pursue this idea further.  In the meantime, we
should strive to make the arguments to the individual solvers as
uniform as possible (e.g. 'tol', 'maxiter', preconditioners, etc).
This will make LinearSolver() etc. easier to create.


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


More information about the Scipy-dev mailing list