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

greg whittier gregwh at gmail.com
Tue Jul 12 12:16:29 EDT 2011


On Tue, Jul 12, 2011 at 11:30 AM, Gael Varoquaux
<gael.varoquaux at normalesup.org> 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 2x2 to 8x8 at most.
>
> If you really care about speed, for matrices of this size you shouldn't
> call a linear algebra pack, but simply precompute the close-form
> solution. Here is sympy code that I used a while ago to generate fast
> code to do inverse of SPD matrices.
>
> G

This has been a very timely discussion for me since I'm looking to do
the same thing with a different application.  My interest in
diagonalizing lots of small matrices (not inverting).  I believe the
OP was also interested in eigenvalues.  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?

The ones I'm looking at now happen to be 3x3, so I was thinking of
using http://en.wikipedia.org/wiki/Eigenvalue_algorithm#Eigenvalues_of_a_Symmetric_3x3_Matrix
but I might have anywhere from 2 to 10 at some point.  (To add another
spin to this, I recently acquired an NVIDIA Tesla card and am thinking
of using it for this problem.)

Thanks,
Greg



More information about the NumPy-Discussion mailing list