Index: matrix.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/numeric/ublas/matrix.hpp,v retrieving revision 1.72 diff -b -d -u -r1.72 matrix.hpp --- matrix.hpp 6 Dec 2006 09:34:01 -0000 1.72 +++ matrix.hpp 6 Jan 2007 16:03:24 -0000 @@ -20,6 +20,8 @@ #include #include #include +#include +#include // Iterators based on ideas of Jeremy Siek @@ -941,6 +943,28 @@ return reverse_iterator2 (begin2 ()); } + // Serialization + template + void serialize(Archive & ar, const unsigned int /* file_version */){ + + // we need to copy to a collection_size_type to get a portable + // and efficient serialization + serialization::collection_size_type s1 (size1_); + serialization::collection_size_type s2 (size2_); + + // serialize the sizes + ar & serialization::make_nvp("size1",s1) + & serialization::make_nvp("size2",s2); + + // copy the values back if loading + if (Archive::is_loading::value) + { + size1_ = s1; + size2_ = s2; + } + ar & serialization::make_nvp("data",data); + } + private: size_type size1_; size_type size2_; @@ -1960,6 +1984,28 @@ return reverse_iterator2 (begin2 ()); } + // Serialization + template + void serialize(Archive & ar, const unsigned int /* file_version */){ + + // we need to copy to a collection_size_type to get a portable + // and efficient serialization + serialization::collection_size_type s1 (size1_); + serialization::collection_size_type s2 (size2_); + + // serialize the sizes + ar & serialization::make_nvp("size1",s1) + & serialization::make_nvp("size2",s2); + + // copy the values back if loading + if (Archive::is_loading::value) + { + size1_ = s1; + size2_ = s2; + } + ar & serialization::make_nvp("data",data); + } + private: size_type size1_; size_type size2_; @@ -4039,6 +4085,28 @@ return reverse_iterator2 (begin2 ()); } + // Serialization + template + void serialize(Archive & ar, const unsigned int /* file_version */){ + + // we need to copy to a collection_size_type to get a portable + // and efficient serialization + serialization::collection_size_type s1 (size1_); + serialization::collection_size_type s2 (size2_); + + // serialize the sizes + ar & serialization::make_nvp("size1",s1) + & serialization::make_nvp("size2",s2); + + // copy the values back if loading + if (Archive::is_loading::value) + { + size1_ = s1; + size2_ = s2; + } + ar & serialization::make_array(data_, N); + } + private: size_type size1_; size_type size2_;