help-octave
[Top][All Lists]
Advanced

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

Re: Condensing indices in a matrix


From: Brett Green
Subject: Re: Condensing indices in a matrix
Date: Tue, 22 Dec 2020 16:53:51 -0500

On Tue, Dec 22, 2020 at 12:49 AM Kai Torben Ohlhus <k.ohlhus@gmail.com> wrote:

It has been a longer project, but I hope it was worth the outcome.
Looking at your matrices M with the "spy" command, you can clearly see a
sparse band structure and create them more efficiently with my function
"createMfast" below.

Your function needs for dimension N = 50 (5100 x 5100 dense matrix)
about 4 seconds and about 200 MB on my machine.  From N=100 the
computational cost become too huge.

The function "createMfast" uses sparse banded and boolean matrices (as
your values only deal with {0,1} and for N=500 (501000 x 501000 sparse
banded matrix) only 0.1 seconds creation time are required and it uses
only 17 MB of main memory.  Thus you can grow larger if you want.

The following experiment shows a comparison up to dimension 50 and a
small timing benchmark..

HTH,
Kai

Thank you very much! spdiags is the key I'd been missing. spy will also be very useful as I learn to use spdiags and troubleshoot.
... and to say that the runtime comparison was impressive is an understatement.

reply via email to

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