Re: [Numpy-discussion] inverting and calculating eigenvalues for many small matrices

2011-08-16 Thread Daniel Wheeler
On Tue, Aug 16, 2011 at 5:53 AM, David Warde-Farley wrote: > On 2011-08-15, at 4:11 PM, Daniel Wheeler wrote: > >> One thing that I know I'm doing wrong is >> reassigning every sub-matrix to a new array. This may not be that >> costly, but it seems fairly ugly. I wasn't sure how to pass the >> add

Re: [Numpy-discussion] inverting and calculating eigenvalues for many small matrices

2011-08-16 Thread David Warde-Farley
On 2011-08-15, at 4:11 PM, Daniel Wheeler wrote: > One thing that I know I'm doing wrong is > reassigning every sub-matrix to a new array. This may not be that > costly, but it seems fairly ugly. I wasn't sure how to pass the > address of the submatrix to the lapack routines so I'm assigning to a

Re: [Numpy-discussion] inverting and calculating eigenvalues for many small matrices

2011-08-15 Thread Daniel Wheeler
Hi, I put together a set of tools for inverting, multiplying and finding eigenvalues for many small matrices (arrays of shape (N, M, M) where MxM is the size of each matrix). Thanks to the posoter who suggested using the Tokyo package. Although not used directly, it helped with figuring the correct

Re: [Numpy-discussion] inverting and calculating eigenvalues for many small matrices

2011-07-12 Thread Daniel Wheeler
On Tue, Jul 12, 2011 at 11:19 AM, Sturla Molden wrote: > Den 11.07.2011 23:01, skrev Daniel Wheeler: > To make the loop over N matrices fast, there is nothing that beats a > loop in C or Fortran (or Cython) if you have a 3D array. And that brings > us to the second issue, which is that it would be

Re: [Numpy-discussion] inverting and calculating eigenvalues for many small matrices

2011-07-12 Thread Gael Varoquaux
On Tue, Jul 12, 2011 at 12:16:29PM -0400, greg whittier wrote: > Gael, your code addresses inverses, but I take it something similar for > eigenvalues of a matrix bigger than 5x5 doesn't exists since a > closed-form solution doesn't exist for finding polynomials roots for > order > 5? I guess so :

Re: [Numpy-discussion] inverting and calculating eigenvalues for many small matrices

2011-07-12 Thread greg whittier
On Tue, Jul 12, 2011 at 11:30 AM, Gael Varoquaux wrote: > On Mon, Jul 11, 2011 at 05:01:07PM -0400, Daniel Wheeler wrote: >> Hi, I am trying to find the eigenvalues and eigenvectors as well as >> the inverse for a large number of small matrices. The matrix size >> (MxM) will typically range from 2

Re: [Numpy-discussion] inverting and calculating eigenvalues for many small matrices

2011-07-12 Thread Daniel Wheeler
On Tue, Jul 12, 2011 at 10:52 AM, Dag Sverre Seljebotn wrote: > On 07/12/2011 04:10 PM, Daniel Wheeler wrote: >> On Tue, Jul 12, 2011 at 3:51 AM, Dag Sverre Seljebotn >> Thanks for the heads up. Looks like an option. Presumably, it would >> still have to use "map" even with more direct access to B

Re: [Numpy-discussion] inverting and calculating eigenvalues for many small matrices

2011-07-12 Thread Gael Varoquaux
On Mon, Jul 11, 2011 at 05:01:07PM -0400, Daniel Wheeler wrote: > Hi, I am trying to find the eigenvalues and eigenvectors as well as > the inverse for a large number of small matrices. The matrix size > (MxM) will typically range from 2x2 to 8x8 at most. If you really care about speed, for matri

Re: [Numpy-discussion] inverting and calculating eigenvalues for many small matrices

2011-07-12 Thread Sturla Molden
Den 11.07.2011 23:01, skrev Daniel Wheeler: > The above uses "map" to fake a vector solution, but this is heinously > slow. Are there any better ways to do this without resorting to cython > or weave (would it even be faster (or possible) to use "np.linalg.eig" > and "np.linalg.inv" within cython)?

Re: [Numpy-discussion] inverting and calculating eigenvalues for many small matrices

2011-07-12 Thread Dag Sverre Seljebotn
On 07/12/2011 04:10 PM, Daniel Wheeler wrote: > On Tue, Jul 12, 2011 at 3:51 AM, Dag Sverre Seljebotn > wrote: >> On 07/11/2011 11:01 PM, Daniel Wheeler wrote: >>> Hi, I am trying to find the eigenvalues and eigenvectors as well as >>> the inverse for a large number of small matrices. The matrix

Re: [Numpy-discussion] inverting and calculating eigenvalues for many small matrices

2011-07-12 Thread Daniel Wheeler
On Tue, Jul 12, 2011 at 3:51 AM, Dag Sverre Seljebotn wrote: > On 07/11/2011 11:01 PM, Daniel Wheeler wrote: >> Hi, I am trying to find the eigenvalues and eigenvectors as well as >> the inverse for a large number of small matrices. The matrix size > If you want to go the Cython route, here's a s

Re: [Numpy-discussion] inverting and calculating eigenvalues for many small matrices

2011-07-12 Thread Dag Sverre Seljebotn
On 07/11/2011 11:01 PM, Daniel Wheeler wrote: > Hi, I am trying to find the eigenvalues and eigenvectors as well as > the inverse for a large number of small matrices. The matrix size > (MxM) will typically range from 2x2 to 8x8 at most. The number of > matrices (N) can be from 100 up to a million

[Numpy-discussion] inverting and calculating eigenvalues for many small matrices

2011-07-11 Thread Daniel Wheeler
Hi, I am trying to find the eigenvalues and eigenvectors as well as the inverse for a large number of small matrices. The matrix size (MxM) will typically range from 2x2 to 8x8 at most. The number of matrices (N) can be from 100 up to a million or more. My current solution is to define "eig" and "i