Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages | Search for

# test_mf.cpp

    00001
    00002 #include "Sym.h"
    00003 #include "MultiFunction.h"
    00004 #include "FunDef.h"
    00005
    00006 using namespace std;
    00007
    00008 int main() {
    00009
    00010     Sym v = SymVar(0);
    00011     Sym c = SymConst(0.1);
    00012
    00013     Sym sym = inv(v) + c;
    00014     Sym a = sym;
    00015
    00016     sym = sym * sym;
    00017     Sym b = sym;
    00018     sym = sym + sym;
    00019
    00020     c = sym;
    00021
    00022     vector<Sym> pop;
    00023     pop.push_back(sym);
    00024
    00025     MultiFunction m(pop);
    00026
    00027
    00028     vector<double> vec(1);
    00029     vec[0] = 10.0;
    00030     cout << sym << endl;
    00031
    00032     cout << "Eval " << eval(sym, vec);
    00033
    00034     vector<double> y(1);
    00035
    00036     m(vec,y);
    00037
    00038     cout << " " << y[0] << endl;
    00039
    00040     cout << "3 " << eval(a,vec) << endl;
    00041     cout << "4 " << eval(b, vec) << endl;
    00042     cout << "5 " << eval(c, vec) << endl;
    00043
    00044 }
    00045