Commit 95fe1e08 authored by ullmannsven's avatar ullmannsven Committed by Stephan Rave
Browse files

fixed error in generalized_svd, added necessasry asserts in rrf

parent 117b04df
...@@ -145,6 +145,9 @@ def rrf(A, source_product=None, range_product=None, q=2, l=8, return_rand=False, ...@@ -145,6 +145,9 @@ def rrf(A, source_product=None, range_product=None, q=2, l=8, return_rand=False,
else: else:
assert isinstance(source_product, Operator) assert isinstance(source_product, Operator)
assert 0 <= l <= min(A.source.dim, A.range.dim) and isinstance(l, int)
assert q >= 0 and isinstance(q, int)
R = A.source.random(l, distribution='normal') R = A.source.random(l, distribution='normal')
if iscomplex: if iscomplex:
...@@ -235,10 +238,10 @@ def random_generalized_svd(A, range_product=None, source_product=None, modes=3, ...@@ -235,10 +238,10 @@ def random_generalized_svd(A, range_product=None, source_product=None, modes=3,
U_b, s, Vh_b = sp.linalg.svd(R_B.T, full_matrices=False) U_b, s, Vh_b = sp.linalg.svd(R_B.T, full_matrices=False)
with logger.block(f'Computing generalized left-singular vectors ({modes} vectors) ...'): with logger.block(f'Computing generalized left-singular vectors ({modes} vectors) ...'):
U = Q.lincomb(U_b) U = Q.lincomb(U_b.T)
with logger.block(f'Computung gerneralized right-singular vector ({modes} vectors) ...'): with logger.block(f'Computung generalized right-singular vector ({modes} vectors) ...'):
Vh = Q_B.lincomb(Vh_b.T) Vh = Q_B.lincomb(Vh_b)
return U[:modes], s[:modes], Vh[:modes] return U[:modes], s[:modes], Vh[:modes]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment