示例#1
0
void load( Archive & ar,
           Eigen::Tensor<T,1> & t,
           const unsigned int file_version )
{
    int n0,n1=1,n2=1;
    ar >> BOOST_SERIALIZATION_NVP( n0 );
    t.resize( n0 );
    ar >> make_array( t.data(), n0 );
}
示例#2
0
void save( Archive & ar,
           const Eigen::Tensor<T,N> & t,
           const unsigned int file_version )
{
    int n0 = t.dimension(0);
    ar << BOOST_SERIALIZATION_NVP( n0 );
    if ( N >= 2 )
    {
        int n1 = t.dimension(1);
        ar << BOOST_SERIALIZATION_NVP( n1 );
    }
    if ( N >= 3 )
    {
        int n2 = t.dimension(2);
        ar << BOOST_SERIALIZATION_NVP( n2 );
    }

    ar << boost::serialization::make_array( t.data(),
                                            t.size() );
}