Re: Condensing indices in a matrix

Brett Green <[email protected]>
Newsgroups gmane.comp.gnu.octave.general
Message-ID <CANkKLCfebw7cRMuVWKHYeUoFuLqx0y1Sswoz_g4br2y99dra-g@mail.gmail.com>
On Tue, Dec 22, 2020 at 12:49 AM Kai Torben Ohlhus <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.