Re: [Numpy-discussion] vectorized multi-matrix multiplication

2012-08-26 Thread Jonathan Taylor
Assuming matrices1 and matrices2 are actually arrays of size (N, 3, 3) you can do: np.einsum('nij,njk->nik', matrices1, matrices2) On Sun, Aug 26, 2012 at 11:04 AM, Alex Flint wrote: > I have two lists of 3x3 arrays and I would like to compute the matrix > product of the i-th element in the firs

Re: [Numpy-discussion] Behaviour of ndarray and other objects with __radd__?

2011-06-15 Thread Jonathan Taylor
ibute can also be defined by objects that are not sub-types of >> the ndarray" >> >> -=- Olivier >> >> 2011/6/15 Jonathan Taylor >>> >>> Hi, >>> >>> I would like to have objects that I can mix with ndarrays in >>> arithm

[Numpy-discussion] Behaviour of ndarray and other objects with __radd__?

2011-06-15 Thread Jonathan Taylor
Hi, I would like to have objects that I can mix with ndarrays in arithmetic expressions but I need my object to have control of the operation even when it is on the right hand side of the equation. I realize from the documentation that the way to do this is to actually subclass ndarray but this i

[Numpy-discussion] Add New Functionality for Indexing Along an Axis to Numpy?

2011-03-14 Thread Jonathan Taylor
resorted to loops in the past to solve this not uncommon use case so perhaps it would be helpful to more people if it (or something similar?) was included in numpy? Jonathan. On Thu, Mar 10, 2011 at 12:00 PM, Jonathan Taylor wrote: > I see. > > Should functionality like this be included

Re: [Numpy-discussion] Is this the optimal way to take index along a single axis?

2011-03-10 Thread Jonathan Taylor
I see. Should functionality like this be included in numpy? Jon. On Tue, Mar 8, 2011 at 3:39 PM, wrote: > On Tue, Mar 8, 2011 at 3:03 PM, Jonathan Taylor > wrote: >> I am wanting to use an array b to index into an array x with dimension >> bigger by 1 where the element o

[Numpy-discussion] Is this the optimal way to take index along a single axis?

2011-03-08 Thread Jonathan Taylor
I am wanting to use an array b to index into an array x with dimension bigger by 1 where the element of b indicates what value to extract along a certain direction. For example, b = x.argmin(axis=1). Perhaps I want to use b to create x.min(axis=1) but also to index perhaps another array of the sam

Re: [Numpy-discussion] OT: performance in C extension; OpenMP, or SSE ?

2011-02-15 Thread Jonathan Taylor
Take a look at a nice project coming out of my department: http://code.google.com/p/cudamat/ Best, Jon. On Tue, Feb 15, 2011 at 11:33 AM, Sebastian Haase wrote: > Wes, > I think I should have a couple of GPUs. I would be ready for anything > ... if you think that I could do some easy(!) CUDA p

[Numpy-discussion] Indexing transposes the array?

2009-09-21 Thread Jonathan Taylor
Why does indexing seem to transpose this array? In [14]: x = arange(8).reshape((2,2,2)) In [15]: x[0,:,:] Out[15]: array([[0, 1], [2, 3]]) In [16]: x[0,:,[0,1]] Out[16]: array([[0, 2], [1, 3]]) Thanks, Jonathan. ___ NumPy-Discussion mailin

Re: [Numpy-discussion] Strange crash in numpy.linalg.lstsq.

2009-08-18 Thread Jonathan Taylor
and I hope this helps someone. Jonathan. On Mon, Aug 17, 2009 at 5:34 PM, Keith Goodman wrote: > On Mon, Aug 17, 2009 at 2:27 PM, Jonathan > Taylor wrote: >> It seems to automatically detect it though.  Specifically >> lapack_lite.so always seems to reference libatlas. >> &g

[Numpy-discussion] How to compile numpy without ATLAS support?

2009-08-17 Thread Jonathan Taylor
I am wondering how I might be able to compile numpy without ATLAS on a ubuntu machine that has an atlas deb installed. It seems that the numpy build routine automatically detects it. Thanks for any help, Jonathan. ___ NumPy-Discussion mailing list NumPy

Re: [Numpy-discussion] Strange crash in numpy.linalg.lstsq.

2009-08-17 Thread Jonathan Taylor
It seems to automatically detect it though. Specifically lapack_lite.so always seems to reference libatlas. On Mon, Aug 17, 2009 at 5:21 PM, Keith Goodman wrote: > On Mon, Aug 17, 2009 at 2:13 PM, Jonathan > Taylor wrote: >> Is there some alternative to get a working numpy going?

Re: [Numpy-discussion] Strange crash in numpy.linalg.lstsq.

2009-08-17 Thread Jonathan Taylor
: > On Mon, Aug 17, 2009 at 1:50 PM, Jonathan > Taylor wrote: >> I compiled lapack and atlas from scratch using g77 but now >> numpy.test() hangs when I try to use any numpy functionality.  I think >> I saw someone else write about this.  Is this a common problem? > > Yes

Re: [Numpy-discussion] Strange crash in numpy.linalg.lstsq.

2009-08-17 Thread Jonathan Taylor
17, 2009 at 1:43 PM, Jonathan Taylor > wrote: >> >> Hi, >> >> I am using a computer that is administered.  It is an intel Ubuntu box >> and came with an ATLAS compiled.  I thus compiled my own numpy1.3.0 >> against that ATLAS. >> >> I was thi

Re: [Numpy-discussion] Strange crash in numpy.linalg.lstsq.

2009-08-17 Thread Jonathan Taylor
, Jonathan. On Mon, Aug 17, 2009 at 3:12 PM, Charles R Harris wrote: > > > On Mon, Aug 17, 2009 at 11:42 AM, Jonathan Taylor > wrote: >> >> Hi, >> >> I am getting a strange crash in numpy.linalg.lstsq.  I have put the code >> that causes the crash

[Numpy-discussion] Strange crash in numpy.linalg.lstsq.

2009-08-17 Thread Jonathan Taylor
Hi, I am getting a strange crash in numpy.linalg.lstsq. I have put the code that causes the crash along with two data files on my website at: http://www.cs.toronto.edu/~jtaylor/crash/ I would be interested to know if this bug can be duplicated and/or if anyone has any suggestions as to why: im

Re: [Numpy-discussion] performance matrix multiplication vs. matlab

2009-07-22 Thread Jonathan Taylor
/usr/local/lib. > You can remove the ones in /usr/lib or "export > LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH". > > Hope it helps. > > Best, > > N > > On Fri, Jul 17, 2009 at 3:57 PM, Jonathan > Taylor wrote: >> Following these instructions I h

Re: [Numpy-discussion] performance matrix multiplication vs. matlab

2009-07-17 Thread Jonathan Taylor
Following these instructions I have the following problem when I import numpy. Does anyone know why this might be? Thanks, Jonathan. >>> import numpy Traceback (most recent call last): File "", line 1, in File "/home/jtaylor/lib/python2.5/site-packages/numpy/__init__.py", line 130, in

Re: [Numpy-discussion] Scipy Conference 2009 Lecture Recordings

2009-07-17 Thread Jonathan Taylor
I would also like to see this. Have we looked at using videolectures.net? In my field, the people from videolectures.net takes care of filming and editing. I am not sure, but they might actually be free as they have a big grant from the EU to do this sort of thing. It might be worth pinging the

Re: [Numpy-discussion] is it a bug?

2009-03-11 Thread Jonathan Taylor
You lost me on > x = np.arange(30) > x.shape = (2,3,5) For me I get: In [2]: x = np.arange(30) In [3]: x.shape Out[3]: (30,) which is what I would expect. Perhaps I missed something? Jon. On Wed, Mar 11, 2009 at 8:55 PM, shuwj5...@163.com wrote: > Hi, > > import numpy as np > x = np.arange(

Re: [Numpy-discussion] A module for homogeneous transformation matrices, Euler angles and quaternions

2009-03-04 Thread Jonathan Taylor
Looks cool but a lot of this should be done in an extension module to make it fast. Perhaps starting this process off as a separate entity until stability is acheived. I would be tempted to do some of this using cython. I just wrote found that generating a rotation matrix from euler angles is ab

Re: [Numpy-discussion] Faster way to generate a rotation matrix?

2009-03-04 Thread Jonathan Taylor
Just for other peoples reference I eventually went with a cython version that goes about twice as fast as my old post. Here it is: import numpy as np cimport numpy as np cdef extern from "math.h": double cos(double) double sin(double) def rotation(np.ndarray[double] theta): cdef np.

Re: [Numpy-discussion] Faster way to generate a rotation matrix?

2009-03-03 Thread Jonathan Taylor
al calls in your loop each time. >> >> I can also recommend Chapter 2 of Introduction to Robotics: Mechanics and >> Controls by John J. Craig for more on more efficient transformations. >> >> >> >> >> >> On Tue, Mar 3, 2009 at 7:19 PM, Robert Kern

Re: [Numpy-discussion] Faster way to generate a rotation matrix?

2009-03-03 Thread Jonathan Taylor
Sorry.. obviously having some copy and paste trouble here. The message should be as follows: Hi, I am doing optimization on a vector of rotation angles tx,ty and tz using scipy.optimize.fmin. Unfortunately the function that I am optimizing needs the rotation matrix corresponding to this vector

[Numpy-discussion] Faster way to generate a rotation matrix?

2009-03-03 Thread Jonathan Taylor
Hi, I am doing optimization on a vector of rotation angles tx,ty and tz using scipy.optimize.fmin. Unfortunately the function that I am optimizing needs the rotation matrix corresponding to this vector so it is getting constructed once for each iteration with new values. >From profiling I can Hi,

Re: [Numpy-discussion] Slicing/selection in multiple dimensions simultaneously

2009-02-28 Thread Jonathan Taylor
Hi Dave. This does seem like the only way to write this nicely. Unfortunately, I think this may be wasteful memory wise (in contrast to what the obvious matlab code would do) as it constructs an array with the whole first index intact at first. I think I will use it anyways though as I find the

Re: [Numpy-discussion] Slicing/selection in multiple dimensions simultaneously

2009-02-26 Thread Jonathan Taylor
Am I right to assume that there is no way elegant way to interact with slices. i.e. Is there anyway to get a[ix_([2,3,6],:,[3,2])] to work? So that the dimension is completely specified? Or perhaps the only way to do this is via a[ix_([2,3,6],range(a.shape[1]),[3,2])] If anyone knows a bette

Re: [Numpy-discussion] Testing for close to zero?

2009-01-19 Thread Jonathan Taylor
Interesting. That makes sense and I suppose that also explains why there is no function to do this sort of thing for you. Jon. On Mon, Jan 19, 2009 at 3:55 PM, Robert Kern wrote: > On Mon, Jan 19, 2009 at 14:43, Jonathan Taylor > wrote: >> Hi, >> >> When solving a

[Numpy-discussion] Testing for close to zero?

2009-01-19 Thread Jonathan Taylor
Hi, When solving a quadratic equation I get that alpha = -3.78336776728e-31 which I believe to be far below machine precision: finfo(float).eps 2.2204460492503131e-16 But an if statement like: if alpha == 0: ... does not catch this. Is there a better way to check for things that are essent

[Numpy-discussion] Faster array version of ndindex

2007-12-13 Thread Jonathan Taylor
I was needing an array representation of ndindex since ndindex only gives an iterator but array(list(ndindex)) takes too long. There is prob some obvious way to do this I am missing but if not feel free to include this code which is much faster. In [252]: time a=np.array(list(np.ndindex(10,10,10,