help-octave
[Top][All Lists]

## Re: Trouble understanding cidx used in sparse matrices

 From: Carlo de Falco Subject: Re: Trouble understanding cidx used in sparse matrices Date: Thu, 18 Feb 2016 10:49:30 +0100

Il 18/feb/2016 10:45, "Marco Atzeri" <address@hidden> ha scritto:
>
>
>
> On 18/02/2016 10:05, Shamika Mohanan wrote:
>>
>> I'm not able to understand the cidx vector given here-
>> https://www.gnu.org/software/octave/doc/interpreter/Storage-of-Sparse-Matrices.html
>> and here- http://arxiv.org/pdf/cs/0604006v1.pdf
>>
>> cidx  = [0, 1, 2, 2, 4]
>>
>> I understand why it starts with 0. What does 1, 2, 2, 4 represent?
>>
>> Shamika
>>
>>
>
> The number of elements in the i-th column is
> given by cidx (i + 1) - cidx (i).
>
>
> 1-0 = 1 element on column 0
> 2-1 = 1 element on column 1
> 2-2 = 0 element on column 2
> 4-2 = 2 elements on column 3
>
>

If you need more details, here you can find a paper describing the implementation of sparse matrices in Octave:
http://arxiv.org/abs/cs/0604006
c.