Re: [Numpy-discussion] Apply transform to many small matrices

2013-02-27 Thread Jorge Scandaliaris
Jaime Fernández del Río gmail.com> writes: > np.einsum makes a lot of these easier to figure out: > In [7]: np.einsum('ijk, kl', A, T) > Out[7]:  > array([[[ 7, 10], >         [15, 22]], > >        [[23, 34], >         [31, 46]], > >        [[39, 58], >         [47, 70]]]) > Thanks, I will h

Re: [Numpy-discussion] Apply transform to many small matrices

2013-02-27 Thread Jorge Scandaliaris
Jorge Scandaliaris yahoo.es> writes: <...> > I have an ndarray A of shape (M,2,2) representing M 2 x 2 matrices. > Now I want to apply a transform T of shape (2,2) to each of matrix. > The way I do this now is by iterating over all rows of A > multiplying the mat

[Numpy-discussion] Apply transform to many small matrices

2013-02-27 Thread Jorge Scandaliaris
Hi, First of all excuse me if this is a trivial question. I have the feeling it is, but searching and looking through the docs has proven unsuccesful so far. I have an ndarray A of shape (M,2,2) representing M 2 x 2 matrices. Now I want to apply a transform T of shape (2,2) to each of matrix. The

Re: [Numpy-discussion] Array mapping question

2010-03-16 Thread Jorge Scandaliaris
gmail.com> writes: > If I remember correctly it was unique1d in numpy 1.3 that had the > return_inverse options. > > Check the functions in arraysetops for numpy 1.3. > unique1d is in my help file for numpy 1.2 (which was the fastest for > me to look up) > You're right, again. unique1d is in

Re: [Numpy-discussion] Array mapping question

2010-03-16 Thread Jorge Scandaliaris
gmail.com> writes: > > If I understand correctly, then you want return_inverse (the original > array recoded to using integers 0...len(ctab)-1 > > Josef Right, thanks! I didn't see this cause I use numpy 1.3, where this is not available. Jorge

[Numpy-discussion] Array mapping question

2010-03-16 Thread Jorge Scandaliaris
Hi, I have a 1D array containing indexes to specific measurements. As this array is a slice of a bigger one, the indexes don't necessarily start at 0 nor they are sequential. For example, I can have an array A where In [34]: A.shape Out[34]: (4764,) In [35]: ctab = np.unique(A) In [36]: ctab Out[3

[Numpy-discussion] How to apply a function to an ndarray over a given dimension

2010-03-10 Thread Jorge Scandaliaris
Hi, First, excuse me if I am over-optimizing, but I am curious if there exist a way to apply a function to an ndarray over a given dimension. In case I don't make myself clear, I have an array of shape( n,2,2) where each row represents a 2 by 2 covariance matrix, and I want to perform the eigenvalu

Re: [Numpy-discussion] Question about np.savez

2009-09-02 Thread Jorge Scandaliaris
Thanks David, Robert and Francesc for comments and suggestions. It's nice having options, but that also means one has to choose ;) I will have a closer look at pytables. The thing that got me "scared" about it was the word database. I have close to zero experience using or, even worst, designing da

Re: [Numpy-discussion] Question about np.savez

2009-09-01 Thread Jorge Scandaliaris
David Warde-Farley cs.toronto.edu> writes: > If you actually want to save multiple arrays, you can use > savez('fname', *[a,b,c]) and they will be accessible under the names > arr_0, arr_1, etc. and a list of these names is in the 'files' > attribute on the NpzFile object. To retrieve your l

Re: [Numpy-discussion] Question about slicing

2009-05-16 Thread Jorge Scandaliaris
Pauli Virtanen iki.fi> writes: > > img = array(img)[::-1] > > Note that here a copy is made. You can use `asarray` instead of `array` > if you want to avoid making a copy. > Thanks, that's good info! > > and it worked!, but I am interested actually in sub-regions of this > > image, so the n

Re: [Numpy-discussion] Question about slicing

2009-05-16 Thread Jorge Scandaliaris
Emmanuelle Gouillart normalesup.org> writes: > > Hi Jorge, > > > roi = aimg[10:20,45:50,:] > > are you working with 3-D images? I didn't know PIL was able to handle 3D > images. > Well, if by 3D you mean color images then yes, PIL is able to handle them > I wasn't able to reproduce the beha