Commit dd27957b authored by Stephan Rave's avatar Stephan Rave

[VectorArrayOperator] implement apply_inverse via QR decomposition

parent bff40853
Pipeline #48793 passed with stages
in 141 minutes and 20 seconds
......@@ -841,6 +841,24 @@ class VectorArrayOperator(Operator):
return self.range.make_array(
def apply_inverse(self, V, mu=None, least_squares=False):
if not least_squares and len(V) != V.dim:
raise InversionError
from pymor.algorithms.gram_schmidt import gram_schmidt
from numpy.linalg import lstsq
Q, R = gram_schmidt(self.array, return_R=True, reiterate=False)
if self.adjoint:
v = lstsq(R.T.conj(), V.to_numpy().T)[0]
U = Q.lincomb(v.T)
v =
u = lstsq(R, v)[0]
U = self.source.make_array(u.T)
return U
def apply_adjoint(self, V, mu=None):
assert V in self.range
if not self.adjoint:
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment