upoly
, which provides the operations in this quotient algebra:
namespace quotient { template<class C, class P=UPolDse<C>, class R=upol::horner<C> > struct upoly; }
C
.P
. The default is the type UPolDse<C>
.R
. By default, it is {
upol::horner<C>}.void assign(R& r, const R & a); void assign(R& r, const P & a); void add(R& r, const R & a, const R& b); void add(R& r, const R & a); void sub(R& r, const R & a, const R& b); void sub(R& r, const R & a); void mul(R& r, const R & a, const R& b); void mul(R& r, const R & a, const C& b); void div(R& r, const R & a, const C& b); void square(R& r, const R & a); void print(std::ostream & os, const R & a)
R
modulo a given polynomial of type P
.In order to define the polynomial modulo which we compute, we use the constructor
upoly(const P & p);
#include <synaps/upol/ModUPol.h> typedef UPolDse<double> pol_t; int main() { using namespace std; quotient::upoly<double, pol_t> modpol(pol_t("x0^3-2*x0^2")); upol::horner<double> p,q,r; modpol.assign(p,"x0^2-2*x0+1"); modpol.assign(q,"x0-1"); cout <<"p="; modpol.print(cout,p);cout << endl; cout <<"q="; modpol.print(cout,q);cout << endl;
modpol.add(r,p,q); modpol.print(cout,r);cout << endl;
modpol.mul(r,p,q); modpol.print(cout,r);cout << endl;
}
synaps/upol/ModUPol.h