Re: [Numpy-discussion] numpy grant update

2017-10-26 Thread Marten van Kerkwijk
Hi Nathaniel, That sounds like it could work very well indeed! Somewhat related only, for the inner loops I've been thinking whether it might be possible to automatically create composite ufuncs, where the inner loops are executed in some prescribed order, so that for instance one could define ``

Re: [Numpy-discussion] numpy grant update

2017-10-26 Thread Nathaniel Smith
On Thu, Oct 26, 2017 at 2:11 PM, Nathan Goldbaum wrote: > My understanding of this is that the dtype will only hold the unit metadata. > So that means units would propogate through calculations automatically, but > the dtype wouldn't be able to manipulate the array data (in an in-place unit > conv

Re: [Numpy-discussion] numpy grant update

2017-10-26 Thread Nathaniel Smith
On Thu, Oct 26, 2017 at 1:14 PM, Marten van Kerkwijk wrote: > Hi Nathaniel, > > Thanks for the link. The plans sounds great! You'll not be surprised > to hear I'm particularly interested in the units aspect (and, no, I > don't mind at all if we can stop subclassing ndarray...). Is the idea > that

Re: [Numpy-discussion] numpy grant update

2017-10-26 Thread Marten van Kerkwijk
That sounds somewhat puzzling as units cannot really propagate without them somehow telling how they would change! (e.g., the outcome of sin(a) is possible only for angular units and then depends on that unit). But in any case, the mailing list is probably not the best case to discuss this - rather

Re: [Numpy-discussion] Is there a better way to write a stacked matrix

2017-10-26 Thread Peter Creasey
> > On Thu, Oct 26, 2017 at 12:11 PM, Daniele Nicolodi > > wrote: > > > >> is there a better way to write the dot product between a stack of > >> matrices? In my case I need to compute > >> > >> y = A.T @ inv(B) @ A > >> > >> with A a 3x1 matrix and B a 3x3 matrix, N times, with N in the few > >>

Re: [Numpy-discussion] numpy grant update

2017-10-26 Thread Nathan Goldbaum
My understanding of this is that the dtype will only hold the unit metadata. So that means units would propogate through calculations automatically, but the dtype wouldn't be able to manipulate the array data (in an in-place unit conversion for example). In this world, astropy quantities and yt's

Re: [Numpy-discussion] numpy grant update

2017-10-26 Thread Marten van Kerkwijk
Hi Nathaniel, Thanks for the link. The plans sounds great! You'll not be surprised to hear I'm particularly interested in the units aspect (and, no, I don't mind at all if we can stop subclassing ndarray...). Is the idea that there will be a general way for allow a dtype to define how to convert a

Re: [Numpy-discussion] Is there a better way to write a stacked matrix multiplication

2017-10-26 Thread Stephan Hoyer
I would certainly use einsum. It is almost perfect for these use cases, e.g., np.einsum('ki,kij,kj->k', A, inv(B), A) On Thu, Oct 26, 2017 at 12:38 PM Charles R Harris wrote: > On Thu, Oct 26, 2017 at 12:11 PM, Daniele Nicolodi > wrote: > >> Hello, >> >> is there a better way to write the dot p

Re: [Numpy-discussion] numpy grant update

2017-10-26 Thread Nathaniel Smith
On Wed, Oct 18, 2017 at 10:24 PM, Nathaniel Smith wrote: > I'll also be giving a lunch talk at BIDS tomorrow to let folks locally > know about what's going on, which I think will be recorded – I'll send > around a link after in case others are interested. Here's that link: https://www.youtube.com

Re: [Numpy-discussion] Is there a better way to write a stacked matrix multiplication

2017-10-26 Thread Charles R Harris
On Thu, Oct 26, 2017 at 12:11 PM, Daniele Nicolodi wrote: > Hello, > > is there a better way to write the dot product between a stack of > matrices? In my case I need to compute > > y = A.T @ inv(B) @ A > > with A a 3x1 matrix and B a 3x3 matrix, N times, with N in the few > hundred thousands ra

[Numpy-discussion] Is there a better way to write a stacked matrix multiplication

2017-10-26 Thread Daniele Nicolodi
Hello, is there a better way to write the dot product between a stack of matrices? In my case I need to compute y = A.T @ inv(B) @ A with A a 3x1 matrix and B a 3x3 matrix, N times, with N in the few hundred thousands range. I thus "vectorize" the thing using stack of matrices, so that A is a