-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
ENH: Allow moveaxis() to take strings as axis order #11504
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
Conversation
Tests and handling the case where the strings do not match are missing. This seems like a nice addition, should it hit the mailing list since it is a new feature? |
Note you can already spell this Definitely needs to hit the mailing list. I'm +0 on this - it seems reasonable, but does violate "There should be one-- and preferably only one --obvious way to do it" |
@mattip, I just added the handling and test. I will write to the mailing list as soon as I get the subscription notification.
@eric-wieser You are right, but I think permuting axes using |
I was referring to |
Faster too:
|
Parsing in python vs. parsing in C strikes again (for functions that do very little work). Benchmarking Perhaps this PR could be reframed as mentioning |
@mattip, I could add einsum to the docstring, but I have the feeling that Einstein's sum convention is very little known outside of the field of physics which makes code using @eric-wieser, oh, ok. I thought you meant |
@manuels: My introduction to einstein summation was for continuum mechanics for structural engineering, so I think that's a unfair generalization. |
Thanks for the contribution! At first I thought it was quite cute, but thinking more about it I'd agree with @eric-wieser that it is better to just have one way to use p.s. I also don't think referring to p.s.2 Speed is improved by ~30% by avoiding the |
Are you sure?
|
OK, in that case I do think it is useful to refer to |
I think it probably is - switching all internal uses of rollaxis to moveaxis came with a cost, and it would be nice to partially make up for that |
@eric-jones, sorry, looks like I got the wrong impression about the spread of Einstein's convention.
@mhvk, how do you mean? The only Is there a problem with the mailinglist server? I registered twice but I never got a subscription notification email. |
See #11518 for the speed-up PR. Not 100% happy with it, but it is significantly faster. |
Should just open an issue instead maybe. But is it just me or anyone else finds it very strange and potentially (though a bit concieved) dangerous that einsum does not creating a copy in all cases? EDIT: Even overzealous:
Anyway, I think this is a premature and surprising optimization and should be removed, unless we think it might break someones code (my opinion and I admit this is actually documented further down in the function). |
So, there hasn't been any response on the mailing list. Either that's out of interest or numpy devs are ambivalent with respect to this feature. |
@seberg: Perhaps a |
@manuel: If the mailing list is ambivalent, and we're leaning very slightly against adding it, I think we should stick to the status quo. Thanks for trying to make numpy better though - you kicked off some useful discussions! |
Adds a feature to simplify moving axes around: