help-octave
[Top][All Lists]

## Re: Static storage of huge sparce matrices

 From: Jordi Gutiérrez Hermoso Subject: Re: Static storage of huge sparce matrices Date: Fri, 2 Nov 2012 14:00:28 -0400

```On 2 November 2012 13:50, Joza <address@hidden> 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.

SOR isn't the greatest method to use here, but I imagine this is
merely for pedagogical purposes. You can read this to see what Octave
will actually do:

http://wiki.octave.org/FAQ#How_does_Octave_solve_linear_systems.3F

> 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

x = toeplitz(sparse([1 1], [1 2], [2, -1], 1, 1e3));

> 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.

The actual method Octave uses is compress column sparse, please consult:

http://arxiv.org/abs/cs.MS/0604006

HTH,
- Jordi G. H.

```