[GiNaC-devel] [GiNaC-list] archiving custom functions

grey_earl at web.de grey_earl at web.de
Wed Oct 13 21:41:05 CEST 2010


Hi,

there still seems a problem left - after unarchiving, substituting doesn't work anymore with realsymbols, while it works with symbols.

I augmented the testcase, which now is

#include <iostream>
#include <fstream>
#include <stdexcept>
using namespace std;

#include <ginac/ginac.h>
using namespace GiNaC;

int main() {
archive aro, ari;
realsymbol r("r");
symbol s("s");

ex test, test2;
test = r+s;

cerr << "writing archive\n";
ofstream aus("test.gar");
aro.archive_ex(test, "test");
aus << aro;
aus.close();
cerr << "done writing archive\n";

cerr << "reading archive\n";
ifstream ein("test.gar");
ein >> ari;
ein.close();
cerr << "done reading archive\n";

lst symlst;
symlst = r,s;

cerr << "unarchiving\n";
try {
test2 = ari.unarchive_ex(symlst);
} catch (std::exception &e) {
cerr << e.what() << std::endl;
}
cerr << "recovered expression\n\n";

cerr << "expression = " << test2 << "\n";
test = test2.subs(lst(r==0,s==0));
cerr << "substituting (r=0,s=0) = " << test << "\n";

return 0;
}

Thanks!
___________________________________________________________
GRATIS! Movie-FLAT mit über 300 Videos. 
Jetzt freischalten unter http://movieflat.web.de


More information about the GiNaC-devel mailing list