1 #include <CGAL/Polynomial.h>
2 #include <CGAL/Polynomial_traits_d.h>
3 #include <CGAL/Polynomial_type_generator.h>
4 
main()5 int main(){
6   CGAL::IO::set_pretty_mode(std::cout);
7   typedef CGAL::Polynomial_type_generator<int,2>::Type Poly_2;
8   typedef CGAL::Polynomial_traits_d<Poly_2>            PT_2;
9 
10   //construction using shift
11   Poly_2 x = PT_2::Shift()(Poly_2(1),1,0); // = x^1
12   Poly_2 y = PT_2::Shift()(Poly_2(1),1,1); // = y^1
13 
14   Poly_2 F // = (11*x^2 + 5*x)*y^4 + (7*x^2)*y^3
15     = 11 * CGAL::ipower(y,4) * CGAL::ipower(x,2)
16     + 5 * CGAL::ipower(y,4)  * CGAL::ipower(x,1)
17     + 7 * CGAL::ipower(y,3)  * CGAL::ipower(x,2);
18   std::cout << "The bivariate polynomial F: " << F <<"\n"<< std::endl;
19 
20   PT_2::Get_coefficient get_coefficient;
21   std::cout << "Coefficient of y^0: "<< get_coefficient(F,0) << std::endl;
22   std::cout << "Coefficient of y^1: "<< get_coefficient(F,1) << std::endl;
23   std::cout << "Coefficient of y^2: "<< get_coefficient(F,2) << std::endl;
24   std::cout << "Coefficient of y^3: "<< get_coefficient(F,3) << std::endl;
25   std::cout << "Coefficient of y^4: "<< get_coefficient(F,4) << std::endl;
26   std::cout << "Coefficient of y^5: "<< get_coefficient(F,5) << std::endl;
27   std::cout << std::endl;
28 
29   PT_2::Leading_coefficient lcoeff;
30   std::cout << "Leading coefficient with respect to y:           "
31             << lcoeff(F)   // = 11*x^2 + 5*x
32             << std::endl;
33 
34   PT_2::Get_innermost_coefficient get_icoeff;
35   std::cout << "Innermost coefficient of monomial x^1y^4:        "
36             << get_icoeff(F,CGAL::Exponent_vector(1,4)) // = 5
37             << std::endl;
38 
39   PT_2::Innermost_leading_coefficient ilcoeff;
40   std::cout << "Innermost leading coefficient with respect to y: "
41             << ilcoeff(F) // = 11
42             << std::endl;
43 }
44