-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Optimization of a @ a.H
style operations using BLAS herk routines
#6951
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
Adding an argument to |
Definitely agree with that statement. That being said, it is the easiest to implement out of the three. Though 2 doesn't seem that bad really and is a nice balance of the objectives. |
I quite like the "transposed-complex" type ( |
Would it be all so bad to have an EDIT: Admittingly, linalg mostly only works for numerical types, it would be good to support it also for object type (since we actually use this kind of function ourself in correlate, etc. I think. |
@mhvk: You wouldn't need to rewrite all the ufunc loops, just the casting functions (so @seberg: the python object protocol has no "conjugate" operation so handling object types is kinda doomed regardless :-/ I guess my vote is kinda leaning towards adding a conjugate flag to |
Would it be an idea to adapt That said, I cannot really think of keyword argument names that would lead to code that would be more obvious than just using specific functions. In that sense, @seberg's alternative of adding such functions in p.s. Now if only |
@mhvk vdot is lost in the woods without a vector. Its usefulness is limited. |
@njsmith yes, but I still dislike that our conjugate just ignores object arrays (and if someone puts complex into object arrays, thus some things will just be wrong). The The reason I suggested that was mostly because I thought this function might only take a single argument anyway. But I guess even |
This was (in part) #4887. Note that this will error if the object array contains something that doesn't have a conjugate method, but it does work for all of the python builtin types. |
Hmmm..... My guess is, that was not yet in a release? I hope it will work out ;). But it breaks any code that uses conjugate with very weird numbers or non-numbers. |
So, how about an even simpler option? Allow When this happens, interpret Here is why I think this is a good idea:
|
If we address |
@jakirkham seems awfully magical though. |
@ewmoore, why do you say that? It is just dispatching |
I don't mean the implementation, but the python interface. It isn't anywhere close to obvious what |
I guess I am not thrilled with the keyword argument because we then have to ensure we handle cases like Alternatively, we actually add a new function that does handle this case. |
@jakirkham - I was thinking about the same solution yesterday, but didn't pursue it because readability really counts. The only way out I could think of is having some string placeholder like That's why above I ended up concluding that a special function in p.s. Then again, there has been some talk about allowing some combinations or chaining of |
p.s. The fact that |
Maybe this is just me, but when I see a signature like this As for a method version, I was thinking However, this is just how I think. If people feel this is still unnatural, then we need something else. If we are really concerned that adding or changing arguments to Though adding a new conjugated complex type makes |
@jakirkham: providing support for |
Let me see if I understand you correctly @njsmith, you're saying we feed the conjugate flag into Thinking on this, I propose the following adjustment to your idea. Add keyword arguments to |
I'm a little torn now, truthfully. Given @mhvk reminder about |
I think we should pick this up again at some point, but it sounds like there is a 1.11.0 release in the process of being made. Let's pick this up again after that. |
Any more thoughts on this? |
Joining the thread. I found this GitHub issue by looking into the behavior of I don't really have opinions on how to enable this kind of functionality. Anything that bypasses calling |
Related: #6794
Related: #6932
In addition to optimizing
a @ a.T
usingsyrk
, there should be a way to optimizea @ a.H
usinghyrk
. This is a bit tricky asa.H
is not a view. So, it cannot be done the same way that was done fora @ a.T
( #6932 ). There are number of proposals for handling this optimization in some fashion, but one should be picked.a @ a.T
anda @ a.H
that takesa
and an argument for whether theconj
needs to be taken. ( np.dot(a, a.T) should be detected and dispatched to the BLAS syrk routine #6794 (comment) )dot
that determines whether to do a conjugated dot product or not. ( np.dot(a, a.T) should be detected and dispatched to the BLAS syrk routine #6794 (comment) )np.dot
to allow it to take a single argument to allow for the same behavior presented in 2.Raising to the attention of the previously interested parties: @njsmith @charris @argriffing
The text was updated successfully, but these errors were encountered: