#include #include #include #include #include #include #include #include "throw_with_info.hpp" //#include "boost_extras/serialization/numeric/ublas/include/matrix_sparse.hpp" #include using namespace std; using namespace boost; using namespace numeric; using namespace ublas; #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char *argv[]) { if (argc > 2 || argc < 1) { cerr << "\nSyntax:\n\t" << argv[0] << " \n" << endl; return EXIT_FAILURE; } string fname(lexical_cast(argv[1])); compressed_matrix M(4,3); M(0,0) = 1.1; M(1,1) = 2.2; cout << "\nM =\n" << M << endl; ofstream ofs(fname.c_str(),ios::out | ios::binary); { boost::archive::binary_oarchive oa(ofs); oa << M; } ofs.close(); M.clear(); compressed_matrix M2; ifstream ifs(fname.c_str(),ios::in | ios::binary); { boost::archive::binary_iarchive ia(ifs); ia >> M2; } ifs.close(); cout << "\nre-read matrix:\n" << M2 << endl; cout << "\nDone.\n" << endl; return EXIT_SUCCESS; }