33# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
44
55from pymor .operators .interface import Operator
6- from pymor .operators .constructions import ZeroOperator
76
87from pymor_dealii .pymor .vectorarray import DealIIVectorSpace
98import pymor_dealii_bindings as pd2
@@ -33,7 +32,7 @@ def apply_transpose(self, V, mu=None):
3332 self .matrix .Tvmult (r .impl , u .impl )
3433 return U
3534
36- def apply_inverse (self , V , mu = None , least_squares = False ):
35+ def apply_inverse (self , V , mu = None , initial_guess = None , least_squares = False ):
3736 assert V in self .range
3837 if least_squares :
3938 raise NotImplementedError
@@ -42,18 +41,23 @@ def apply_inverse(self, V, mu=None, least_squares=False):
4241 self .matrix .cg_solve (r .impl , v .impl )
4342 return R
4443
45- def assemble_lincomb (self , operators , coefficients , solver_options = None , name = None ):
46- if not all (
47- isinstance (op , (DealIIMatrixOperator , ZeroOperator )) for op in operators
48- ):
44+ def _assemble_lincomb (
45+ self ,
46+ operators ,
47+ coefficients ,
48+ identity_shift = 0.0 ,
49+ solver_options = None ,
50+ name = None ,
51+ ):
52+ if not all (isinstance (op , (DealIIMatrixOperator )) for op in operators ):
53+ return None
54+ if identity_shift != 0.0 :
4955 return None
5056 assert not solver_options # linear solver is not yet configurable
5157
5258 matrix = pd2 .SparseMatrix (operators [0 ].matrix .get_sparsity_pattern ())
5359 matrix .copy_from (operators [0 ].matrix )
5460 matrix *= coefficients [0 ]
5561 for op , c in zip (operators [1 :], coefficients [1 :]):
56- if isinstance (op , ZeroOperator ):
57- continue
5862 matrix .add (c , op .matrix )
5963 return DealIIMatrixOperator (matrix , name = name )
0 commit comments