Boost logo

Ublas :

From: Nico Galoppo (nico_at_[hidden])
Date: 2007-11-17 17:32:59


Nevermind. I obviously have issues with this matrix, because you'd
expect at least one non-zero per row (or atleast I was, there was a
bug in my code).

Now I wonder what the expected behavior should be of serialization of
such sparse matrices that have rows without non-zeroes.

--nico

On Nov 17, 2007 10:42 AM, Nico Galoppo <nico_at_[hidden]> wrote:
> Hi,
>
> I'm having issues with serialization (malloc problems), and I'm trying
> to figure out where the bug is (ublas or own code). I noticed
> something bizarre in the output of my serialization of a
> compressed_matrix, vs. Gunter's example code output.
>
> I create and fill a compressed_matrix as follows, and then I make a
> copy (just to make sure that less storage is required, see issue
> below).
>
> ublas::compressed_matrix<double> K;
> // ... fill K ..
> // Make a copy
> ublas::compressed_matrix<double> Kcopy;
>
>
> Then, the result xml file is like this:
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
> <!DOCTYPE boost_serialization>
> <boost_serialization signature="serialization::archive" version="4">
> <K class_id="0" tracking_level="0" version="0">
> <size1>1617</size1>
> <size2>1617</size2>
> <capacity>1617</capacity>
> <filled1>148</filled1>
> <filled2>147</filled2>
> <index1_data class_id="1" tracking_level="0" version="0">
> <size>1618</size>
> ...
> </index1_data>
> <index2_data>
> <size>1617</size>
> ...
> <item>3221221576</item>
> <item>0</item>
> <item>0</item>
> </index2_data>
> <value_data class_id="2" tracking_level="0" version="0">
> <size>1617</size>
> ....
>
> Notice that index1_data size is 1618, where it should only be 148
> (filled1). These sizes match up in Gunter's example, they don't in my
> case. This causes garbage data in index1_data after item 148.
>
> Also, why is capacity so big? Making a copy, I would expect only the
> nnz() in matrix K should be required storage upon construction of
> Kcopy.
>
> Thanks!
>
> --nico
>
> --
> Nico Galoppo :: http://www.ngaloppo.org
>

-- 
Nico Galoppo :: http://www.ngaloppo.org