realroot_doc 0.1.1
|
# include "realroot/polynomial_tensor.hpp" # include "realroot/polynomial_univariate.hpp" template<class POL> void test() { using namespace mmx; POL m0(1), m1(1,3), m2(2.1,2,3); std::cout<<m0<<std::endl; std::cout<<m1<<std::endl; std::cout<<m2<<std::endl; POL s=m1+m2; std::cout<<"+ : "<< s <<std::endl; std::cout<<"- : "<< m1-m2 <<std::endl; std::cout<<"- : "<< -m2 <<std::endl; std::cout<<"* : "<< m1*m2 <<std::endl; m1 *= 4.2; std::cout<<"*= : "<<m1<<std::endl; m1 += 3.1; std::cout<<"+= : "<<m1<<std::endl; m1 -= 2; std::cout<<"-= : "<<m1<<std::endl; POL p("a^2+a-2"); std::cout <<p<<std::endl; p *= m1; std::cout<<"*= : "<<p<<std::endl; p += m2; std::cout<<"+= : "<<p<<std::endl; p -= m1; std::cout<<"-= : "<<p<<std::endl; // POL p; std::cout <<p<<std::endl; // q=p*p; std::cout<<q<<std::endl; } int main(int argc, char** argv) { using namespace mmx; test< polynomial< double, with<MonomialTensor> > >(); test< polynomial< double, with<Univariate> > >(); }