New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add check_finite
and check_cond
in NumpyMatrixOperator
and use SciPy solvers elsewhere
#2111
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with the new import conventions imposed by the PR. Could you move this part into a separate PR?
Two of them (banning |
05cfd3c
to
4120938
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with the changes. However, we should add a bit more documentation:
- Add a comment to the docstring of
NumpyMatrixOperator
discussing that disabling the condition number check might be favorable for performance in the ROM case. - Document somewhere why using
from scipy.linalg import foo
is forbidden. - Better explain in the first PR comment what has been changed.
- Choose better title for PR.
solve
from NumPy and SciPycheck_finite
and check_cond
in NumpyMatrixOperator
and use SciPy solvers elsewhere
7dc4446
to
9df1810
Compare
Closes #1052.
Since #1603,
NumpyMatrixOperator
caches the LU factorization and checks the condition number. To enable fasterapply_inverse
, especially for small matrices, this PR addscheck_finite
andcheck_cond
default inNumpyMatrixOperator.apply_inverse
.Regarding the choice between NumPy and SciPy linalg routines, it seems that SciPy is used predominantly (see the two
grep
s below, which was enabled by forbiddingimport scipy
andfrom numpy.linalg import
). Therefore, this PR replaces NumPy'ssolve
,lstsq
,inv
,qr
,eigvals
by SciPy's (insrc/
).NumpyMatrixOperator
useslu_factor
andlu_solve
.Places where
numpy.linalg.solve
is used:Places where
scipy.linalg.solve
is used: