help-octave
[Top][All Lists]
Advanced

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

Re: eig on several matrices in a vectorized manner


From: Juan Pablo Carbajal
Subject: Re: eig on several matrices in a vectorized manner
Date: Sun, 21 Oct 2018 23:06:14 +0200

Hi,

It would be useful to have a simple code to test your results.

Also, how many matrices do you need to process? for a few hundrerds,
looping is not the source of cost, it is just the cost of eig itself.
I do not see much point on vectorizing eig (maybe I can be convinced
otehrwise) so I think the options for speed up here are:

1. paralelization
2. sending the loop a level bellow e.g. cellfun (do not expect huge
improvements)

Alternatively, (and risky) if your matrix set is homogenous in size
(ie.e. all matrice have the same size), try to reduce the set into a
basis of matrices and try exploit Horn's conjecture[1].

[1]: https://terrytao.wordpress.com/tag/schur-horn-inequalities/
On Fri, Oct 19, 2018 at 5:02 PM niconeuman <address@hidden> wrote:
>
> Greetings,
> 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: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
>
>



reply via email to

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