Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2007-07-14 16:48:36


Am Donnerstag, 12. Juli 2007 04:06 schrieb choon:
> Thanks for your reply. Actually, what I was looking for is the way to
> access the memory location used by compressed_matrix, i.e., the
> rowptr, col and val.
> In other words, can I access the underlying mem location of
> index1_data(), index2_data() and value_data() directly? Are those
> data structures allocated sufficient memory space (assumming I
> provide num_row, num_col and nnz to the compressed_matrix
> constructor)?

The number nnz defines how much storage is allocated on construction.
However filling the arrays by hand would not work because filled1_,
filled2_ and some more internal counters have to be adjusted as well.
The simplest way is to fill the matrix using push_back(i,j,value) if you
can provide the elements in correct order. Alternatively you can try
the new serialization interface to deserialize the matrix fields from a
binary archive. The fastest but most difficult way would be to add a
new constructor using shallow_array_adaptors to refer to the already
prepared data.

HTH
Gunter