#NEWLINE# def __init__( self , rdiff = None , method = 'lgmres' , inner_maxiter = 20 , inner_M = None , outer_k = 10 , **kw ) : #NEWLINE# #INDENT# self . preconditioner = inner_M #NEWLINE# self . rdiff = rdiff #NEWLINE# self . method = dict ( bicgstab = scipy . sparse . linalg . bicgstab , gmres = scipy . sparse . linalg . gmres , lgmres = scipy . sparse . linalg . lgmres , cgs = scipy . sparse . linalg . cgs , minres = scipy . sparse . linalg . minres ) . get ( method , method ) #NEWLINE# self . method_kw = dict ( maxiter = inner_maxiter , M = self . preconditioner ) #NEWLINE# if ( self . method is scipy . sparse . linalg . gmres ) : #NEWLINE# #INDENT# self . method_kw [ 'restrt' ] = inner_maxiter #NEWLINE# self . method_kw [ 'maxiter' ] = 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( key . method is scipy . sparse . linalg . lgmres ) : #NEWLINE# #INDENT# self . method_kw [ 'outer_k' ] = outer_k #NEWLINE# self . method_kw [ 'maxiter' ] = 1 #NEWLINE# self . method_kw . setdefault ( 'outer_v' , [ ] ) #NEWLINE# self . method_kw . setdefault ( 'store_outer_Av' , False ) #NEWLINE# #UNINDENT# #UNINDENT# for ( key , value ) in kw . items ( ) : #NEWLINE# #INDENT# if ( not key . startswith ( 'inner_' ) ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Unknown parameter %s' % key ) ) #NEWLINE# #UNINDENT# self . method_kw [ key [ 6 : ] ] = value