Mark Daoust
2016-06-06 00:08:32 UTC
Here's the einsum version:
`es = np.einsum('Na,ab,Nb->N',X,A,X)`
But that's running ~45x slower than your version.
OT: anyone know why einsum is so bad for this one?
Mark Daoust
`es = np.einsum('Na,ab,Nb->N',X,A,X)`
But that's running ~45x slower than your version.
OT: anyone know why einsum is so bad for this one?
Mark Daoust
I recently ran into an application where I had to compute many inner
products quickly (roughy 50k inner products in less than a second). I
My first instinct was to look for a NumPy function to quickly compute
this, such as np.inner. However, it looks like np.inner has some other
behavior and I couldnât get tensordot/einsum to work for me.
Then a labmate pointed out that I can just do some slick matrix
I opened [a PR] with this, and proposed that we define a new function
called `inner_prods` for this.
likely, we need to pick new names for these functions, though we should try
to pick something that doesn't suggest that they are second class
alternatives.
Do we choose new function names? Do we add a keyword arg that changes what
np.inner returns?
[a PR]:https://github.com/numpy/numpy/pull/7690
_______________________________________________
NumPy-Discussion mailing list
https://mail.scipy.org/mailman/listinfo/numpy-discussion
products quickly (roughy 50k inner products in less than a second). I
My first instinct was to look for a NumPy function to quickly compute
this, such as np.inner. However, it looks like np.inner has some other
behavior and I couldnât get tensordot/einsum to work for me.
Then a labmate pointed out that I can just do some slick matrix
I opened [a PR] with this, and proposed that we define a new function
called `inner_prods` for this.
The main challenge is to figure out how to transition the behavior of
all these operations, while preserving backwards compatibility. Quitelikely, we need to pick new names for these functions, though we should try
to pick something that doesn't suggest that they are second class
alternatives.
Do we choose new function names? Do we add a keyword arg that changes what
np.inner returns?
[a PR]:https://github.com/numpy/numpy/pull/7690
_______________________________________________
NumPy-Discussion mailing list
https://mail.scipy.org/mailman/listinfo/numpy-discussion