help-octave
[Top][All Lists]

## Re: Static storage of huge sparce matrices

 From: marco atzeri Subject: Re: Static storage of huge sparce matrices Date: Fri, 02 Nov 2012 19:00:43 +0100 User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2

```On 11/2/2012 6:50 PM, Joza wrote:
```
```To implement a Successive Over Relaxation scheme to iteratively solve Ax = b,
I want to statically store the sparse square matrix A which has dimensions
1000 X 1000.

The diagonal element of A is 2, and the next higher and lower off-diagonals
are both -1. All other elements are zero. Of course, in the first row, there
is no next lower off-diagonal, and no next higher off-diagonal in the last
row.

Obviously, there is no point storing all those zeros. I know that one can
use three arrays to start the elements. ARRAY_1 will store the non-zeros,
ARRAY_2 will store the columns to which the values in ARRAY_1 correspond,
and ARRAY_3 stores where each row begins in ARRAY_1.

I have no idea how I go about implementing these three arrays. How can I
create them? I know Octave has some nice functions for dealing with sparse
matrices - are there functions that I can use for this purpose?

As always, thanks for all the help, you geniuses!! :

```
```
http://www.gnu.org/software/octave/doc/interpreter/Sparse-Matrices.html#Sparse-Matrices

```