octave-maintainers
[Top][All Lists]
Advanced

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

Re: I have a question about internal sparse matrix data structure in Oc


From: c.
Subject: Re: I have a question about internal sparse matrix data structure in Octave
Date: Thu, 17 May 2012 21:18:44 +0200

On 17 May 2012, at 19:00, address@hidden wrote:

> Hi All,
> 
> I am trying to implement the preconditioner for Octave. And I am
> trying to figure out what format octave use for sparse matrix? Is it
> compressed sparse row?
> 

Almost, it's Compressed Sparse Column, you can traverse it like this:

SparseMatrix A (nrows, ncols, 0.0);
 ...

for (octave_idx_type j = 0; j < ncols; j++)
 for (octave_idx_type i = A.cidx (j); i < A.cidx (j+1); i++)
  std::cout << A.data(i);

> Thank you!

c.


reply via email to

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