Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
pyMOR
pymor
Commits
7da45ef4
Commit
7da45ef4
authored
Apr 28, 2022
by
ullmannsven
Committed by
Stephan Rave
May 09, 2022
Browse files
improving numical accuracy by using lu_decomposition instead of the inverse
parent
625a48f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/pymor/algorithms/rand_la.py
View file @
7da45ef4
...
...
@@ -5,6 +5,7 @@
import
numpy
as
np
import
scipy
as
sp
from
scipy.sparse.linalg
import
eigsh
,
LinearOperator
from
scipy.linalg
import
lu_factor
,
lu_solve
from
scipy.special
import
erfinv
from
pymor.algorithms.gram_schmidt
import
gram_schmidt
...
...
@@ -314,8 +315,8 @@ def random_ghep(A, E=None, modes=6, p=20, q=2, single_pass=False):
Y
=
E
.
apply_inverse
(
Y_bar
)
Q
,
R
=
gram_schmidt
(
Y
,
product
=
E
,
return_R
=
True
)
X
=
E
.
apply2
(
Omega
,
Q
)
X_
inv
=
np
.
linalg
.
inv
(
X
)
T
=
X_inv
@
Omega
.
inner
(
Y_bar
)
@
X_inv
.
T
X_
lu
=
lu_factor
(
X
)
T
=
lu_solve
(
X_lu
,
lu_solve
(
X_lu
,
Omega
.
inner
(
Y_bar
)
).
T
)
.
T
else
:
C
=
InverseOperator
(
E
)
@
A
Y
,
Omega
=
rrf
(
C
,
q
=
q
,
l
=
modes
+
p
,
return_rand
=
True
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment