[Scipy-tickets] [SciPy] #1306: Allow for custom inner products in CG, ...

SciPy Trac scipy-tickets@scipy....
Thu Oct 14 10:46:11 CDT 2010


#1306: Allow for custom inner products in CG,...
---------------------------------+------------------------------------------
 Reporter:  nicki                |       Owner:  wnbell
     Type:  enhancement          |      Status:  new   
 Priority:  normal               |   Milestone:  0.9.0 
Component:  scipy.sparse.linalg  |     Version:  0.8.0 
 Keywords:                       |  
---------------------------------+------------------------------------------

Comment(by stefan):

 The input "matrix" A can also be a LinearOperator.  Then you can define Ax
 to be anything you want, e.g.:

 {{{
     >>> from scipy.sparse.linalg import LinearOperator
     >>> from scipy import *
     >>> def mv(v):
     ...     return array([ 2*v[0], 3*v[1]])
     ...
     >>> A = LinearOperator( (2,2), matvec=mv )
     >>> A
     <2x2 LinearOperator with unspecified dtype>
     >>> A.matvec( ones(2) )
     array([ 2.,  3.])
     >>> A * ones(2)
     array([ 2.,  3.])
 }}}

 Would this be a solution to your problem?

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1306#comment:1>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list