Repository navigation
Direct L2 norm computation with vector inner product - #514
anushkasinghh wants to merge 16 commits into
Conversation
|
@anushkasinghh If this PR is ready, you should request potential reviewers. In general you can choose |
campospinto
left a comment
There was a problem hiding this comment.
The changes look good to me, but I don't find the PR title very clear. Instead of describing the changes as a refactor of to array, you should mention the direct computation of array l2 norms using psydac inner products avoiding conversions to numpy arrays. I guess that the point is to save time, did you observe some gain ?
|
I ran the tests before and after the change, and the times are almost the same — around 170 seconds in both cases. The small differences I saw (a few tenths of a second) are just normal fluctuations, so there’s no real speedup. |
|
Hey @anushkasinghh, I added a few suggestions. Most of them are just cosmetics, but the |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
yguclu
left a comment
There was a problem hiding this comment.
I have a couple of further suggestions
Co-authored-by: Julian Owezarek <j.owezarek@googlemail.com> Co-authored-by: Yaman Güçlü <yaman.guclu@ipp.mpg.de>
As I am now working directly on this PR, I am dismissing my own review
Compute the 2-norm of PSYDAC vectors in the unit tests with
Vector.inner, instead of converting the vectors to NumPy arrays withtoarray(fixes #492). Nonp.linalg.norm(... .toarray())is left in the library.Changes:
norm2_sqr(v)topsydac/linalg/tests/utilities.py. It returnsv.inner(v).real, which is also correct for complex vectors. The tests compare it with the squared tolerance, which avoids a square root.norm2_sqr(x)instead ofnp.linalg.norm(x.toarray())intest_linalg.py,test_matrix_free.py,test_kron_direct_solver.py, and `test_solvers.py.test_operator_evaluation, check the results ofS_ILOandS_ILO**2(and ofB_ILOandB_ILO**2). Previously the test checked NumPy'snp.linalg.solveinstead. The error bound for the double inverse is(1 + ||S||) * tol <= 4 * tol, where||S|| < 3follows from the Gershgorin theorem.test_matrix_free.py.Outside
test_operator_evaluation, the element-wise comparisons withnp.allcloseandnp.array_equalare not changed.