[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

eig on several matrices in a vectorized manner

From: niconeuman
Subject: eig on several matrices in a vectorized manner
Date: Fri, 19 Oct 2018 04:04:53 -0500 (CDT)

this is my first post in this mailing-list. I used Matlab for many years but
since 2018 I switched to Octave, and plan to keep using it in my research.
I have to calculate eigenvalues of multiple matrices which have all the same
size (2x2,4x4,8x8, etc) and are Hermitian, repeatedly.
Running this on a loop seems to me to be inefficient. I have tried to do a
small benchmark test in which I compare looping, changing the size of the
matrices and the number of matrices; against generating a supermatrix by
using blkdiag, and taking the eigenvalues all at once.
The blkdiag approach is only faster when the size of the matrices are 2x2,
but for larger systems it becomes quite slower than looping. I imagined this
has to do with the use of memory by the large block supermatrices. So I
tried to convert the individual matrices to sparse before making the block
supermatrix. This has not improved the timings for the block approach.
Perhaps I'm doing something wrong, but in any case, is there some way of
broadcasting the eig function.
I imagine I can write the Cholesky algorithm so that it acts on the elements
of multiple matrices at the same time, and taylor that to my problem. But if
there is some solution already implemented I think it would be better.
Thank you very much!
Best regards,
Nicolás Neuman

Sent from:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]