Thanks for the help guys but maybe I should have been a bit clearer
Basically I am lost with the below block of code I got of the net, particularly where the programmer mentions that 'Generalizations to higher-order tensors are trivial'
Ideally I want to keep at least the no. of dimensions general, but ideally the matrix type as well.
Cheers
/**
* @typedef Defines a matrix type for the example.
* Generalizations to higher-order tensors are trivial
*/
typedef blitz::Array<double, 2> my_Matrix;
/**
* Functions to serialize array. The data() member function in Blitz++
* gives you a pointer to the first element of the array holding the data.
* Be careful if you use a non-default Blitz++ order.
*
* @see
* http://www.boost.org/doc/libs/1_35_0/libs/serialization/doc/wrappers.html
*/
namespace boost{ namespace serialization{
template<class Archive>
inline void save(
Archive & ar,
const ::my_Matrix & t,
const unsigned int file_version)
{
collection_size_type rows(t.rows());
ar << BOOST_SERIALIZATION_NVP(rows);
collection_size_type cols(t.cols());
ar << BOOST_SERIALIZATION_NVP(cols);
if (rows*cols) // save only if it is not empty
ar << make_array(t.data(), t.size());
} }}