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 alex.fl...@gmail.com wrote: I have two lists of 3x3 arrays and I would like to compute the matrix product of the i-th

[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

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

2011-06-15 Thread Jonathan Taylor
by objects that are not sub-types of the ndarray -=- Olivier 2011/6/15 Jonathan Taylor jonathan.tay...@utoronto.ca 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

[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 jonathan.tay...@utoronto.ca wrote: I see. Should functionality like

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, josef.p...@gmail.com wrote: On Tue, Mar 8, 2011 at 3:03 PM, Jonathan Taylor jonathan.tay...@utoronto.ca wrote: I am wanting to use an array b to index into an array x with dimension bigger

[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

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 seb.ha...@gmail.com wrote: Wes, I think I should have a couple of GPUs. I would be ready for anything ... if you think that I could do

[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

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

2009-08-18 Thread Jonathan Taylor
Right... So I was able to get everything working finally. I am not 100% sure how or why it works though so I am going to outline what I did here for reference. I first tried just using LAPACK 3.1.1 (since it seemed set up for g77 instead of gfortran which I do not have). I compiled this to

[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:

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 charlesr.har...@gmail.com wrote: On Mon, Aug 17, 2009 at 11:42 AM, Jonathan Taylor jonathan.tay...@utoronto.ca wrote: Hi, I am getting a strange crash in numpy.linalg.lstsq.  I have put the code that causes the crash along with two

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

2009-08-17 Thread Jonathan Taylor
: On Mon, Aug 17, 2009 at 1:43 PM, Jonathan Taylor jonathan.tay...@utoronto.ca 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 thinking about recompiling ATLAS

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

2009-08-17 Thread Jonathan Taylor
Yes... ATLAS type problems like matrix multiplication. Is there some alternative to get a working numpy going? How might I go about compiling numpy without ATLAS? I really got to get at least something working temporarily. Thanks, Jon. On Mon, Aug 17, 2009 at 5:03 PM, Keith

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 Goodmankwgood...@gmail.com wrote: On Mon, Aug 17, 2009 at 2:13 PM, Jonathan Taylorjonathan.tay...@utoronto.ca wrote: Is there some alternative to

[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

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

2009-07-22 Thread Jonathan Taylor
Sorry. I meant to update this thread after I had resolved my issue. This was indeed one problem. I had to set LD_LIBRARY_PATH. I also had another odd problem that I will spell out here in hopes that I save someone some trouble. Specifically, one should be very sure that the path to the blas

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

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 stdin, line 1, in module File /home/jtaylor/lib/python2.5/site-packages/numpy/__init__.py, line 130, in

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 shuwj5...@163.com wrote: Hi, import numpy as np x

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

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

[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] 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

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

[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

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 robert.k...@gmail.com wrote: On Mon, Jan 19, 2009 at 14:43, Jonathan Taylor jonathan.tay...@utoronto.ca wrote: Hi

[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