-
Notifications
You must be signed in to change notification settings - Fork 135
Fix inplace/layout bugs in Numba lapack routines #1304
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
Fix inplace/layout bugs in Numba lapack routines #1304
Conversation
a27bbf4
to
cbae16b
Compare
Codecov ReportAttention: Patch coverage is
❌ Your patch status has failed because the patch coverage (11.76%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1304 +/- ##
==========================================
- Coverage 82.00% 81.98% -0.02%
==========================================
Files 188 188
Lines 48478 48496 +18
Branches 8665 8671 +6
==========================================
+ Hits 39755 39761 +6
- Misses 6575 6583 +8
- Partials 2148 2152 +4
🚀 New features to boost your workflow:
|
57e5aa4
to
be0df57
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.
Small comments that don't matter, but also double-check the logic in posv
to make sure we can't do better, since the input is symmetric
assert np.allclose(A_val_c_contig, A_val) == (not overwrite_a) | ||
# b vectors are always f_contiguous if also c_contiguous | ||
assert np.allclose(b_val_c_contig, b_val) == ( | ||
not (overwrite_b and b_val_c_contig.flags.f_contiguous) |
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.
not (overwrite_b and b_val_c_contig.flags.f_contiguous) | |
not (overwrite_b and b_val_c_contig.ndims == 1) |
Is more clear? Checking that the c and f flags are both true is not obvious
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.
the col row matrices also have this property
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.
then .squeee().ndims
. I get that checking the other flag is elegant, but it requires detailed knowledge of how all these flags work, which isn't going to obvious to someone reading through these tests for the first time in the future
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.
No, the point is even if you defined it as C-contiguous array, it may still be F-contiguous in which case it will override just like the previous block did. I think this is the most readable test
overwrite_b: bool, | ||
): | ||
if is_complex: | ||
# TODO: Complex raises ValueError: To change to a dtype of a different size, the last axis must be contiguous, |
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 wonder if these bug fixes also fix the error reported here. Not for this PR, just thinking out loud.
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 don't know what code you were running to see the error
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.
Satisfied on the posv point, the rest of the comments can be addressed or not as you see fit
bf7c72a
to
33e00fb
Compare
33e00fb
to
689edc2
Compare
_copy_to_fortran_order
does not seem to do the right thing with vectors and doesn't always copy them.PR did some tricks to avoid copying C-contiguous arrays when not needed.
Proof of the
_copy_to_fortran_order
thing: