# Quotient modulo a univariate polynomial

The quotient modulo a polynomial is implemented as a class 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;
}


• The type of coefficients is C.
• The interface type of polynomials is P. The default is the type UPolDse<C>.
• The type for the internal representation is R. By default, it is {upol::horner<C>}.
This class provides the following functions
 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)

which implements the arithmetic operations of the polynomials of type 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);

## Example

#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;


}


## Implementation

synaps/upol/ModUPol.h