-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Zero sized dimension array handling in np.linalg #10573
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
Comments
@pv thanks, looks like:
If this ticket is of no value let's close it? |
A quick remark on terminology - shape (0, 0) is an empty 2d array. Shape ()
is an 0d array (scalar).
…On Mon, Feb 12, 2018, 06:53 stuartarchibald ***@***.***> wrote:
@pv <https://github.com/pv> thanks, looks like:
1. No. There are outstanding implementations to be dealt with?
2. No. Try and use correct definitions instead.
3. I stand corrected, there are some definitions that are applicable.
It is unusual but in some places valid, even if e.g. LAPACK doesn't always
handle it natively.
If this ticket is of no value let's close it?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#10573 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAZ9LBgNgtIzWUR8IKNqte-p5cFy0H-Bks5tUFBUgaJpZM4SCPZU>
.
|
Thanks @eric-wieser, I'll try and remember to use the terminology/syntax you use for next time :) FWIW I've finished patching Numba and it now replicates what happens in np>=1.13 only, as behaviour before #8368 was less well defined. |
Yeah, I think by now with Erics last bit of work we got the empty array cases to where we want them (mostly earlier, this is also a trend for some other functions, though probably less likely to run into that). If you find something we should rethink please say so, otherwise it seems we are all happy with the new behaviour and agree it is what numba should try to replicate. I am not sure that those we have not yet defined always have an "obvious" result for empty arrays, but if they do, can you open a new issue about it (or maybe we have one already, heh)? Cl A95C osing this I think, but a new issue for functions that do not yet have proper empty array handling would be great. Thanks! |
Thanks for the info @seberg. I think I've managed to replicate everything that went into #8368 and continue to replicate the exceptions for functions that are not currently patched. If it's useful I can open a ticket based on the script I wrote to probe the behaviour of all the linalg functions for empty 2d arrays, disregarding those that have already been patched? |
Sure, we won't change old behaviour. IIRC for some functions it was not quite trivial to find the "correct" non-error behaviour though, but I guess not all remaining ones fall into that category. I think the simple list would suffice, its not like we are likely to add many new functions soon anyway. |
I'm writing some additional error handling code in numba/numba#2737 for Numba's
np.linalg
implementation, specifically to handle arrays with dimensions of size zero.In doing this I've noticed that NumPy 1.10, 1.11 and 1.12 have one set of behaviours and NumPy 1.13 and 1.14 another, and this applies to most functions in
np.linalg
with0d
array(s) as input. As a quick example, running this:over NumPy versions 1.10...1.14:
I think there are three things for discussion:
0d
inputs appears to just be an artifact of the implementation and I wonder if in fact it would be better to simply raise if such an input is presented so that the behaviour is invariant of (future) refactoring of the implementation detail.0d
cases and probably no sensible interpretation. For examplenp.linalg.eig(np.empty((0, 0))
, there's no characteristic polynomial to find the roots of for a system with no dimension, what should happen!?Thanks.
The text was updated successfully, but these errors were encountered: