Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2007-05-30 03:37:39


On Sunday 27 May 2007 11:24, Markus Weimer wrote:
> Hi,
>
> first of all: Thanks for all the replies to my last questions, they
> were very helpful!
>
> For our application, we need to determine the positions in a sparse
> matrix which are non-zero. Is that possible? And if so, how?

1) use the const_iterators. They only traverse the nonzeros.
(see http://freenet-homepage.de/guwi17/ublas/matrix_sparse_usage.html )

2) access the underlying data:

compressed_matrix<double, column_major> has the common CSC layout
index1_data(); // column pointers (size <= no. columns + 1)
index2_data(); // row indices (size nnz)
value_data(); // values (size nnz)

mfg
Gunter