1 #ifndef LIB2GEOM_STURM_HEADER
2 #define LIB2GEOM_STURM_HEADER
9 class sturm :
public std::vector<Poly>{
13 push_back(derivative(X));
16 std::cout <<
"sturm:\n" << Xim1 << std::endl;
17 std::cout << Xi << std::endl;
18 while(Xi.size() > 1) {
21 std::cout << r << std::endl;
22 assert(r.size() < Xi.size());
25 assert(Xim1.size() > Xi.size());
30 unsigned count_signs(
double t) {
32 const double big = 1e20;
34 int old_sign =
sgn((*
this)[0].back());
35 for (
unsigned i = 1; i < size(); i++) {
36 int sign =
sgn((*
this)[i].back());
42 int old_sign =
sgn((*
this)[0].eval(t));
43 for (
unsigned i = 1; i < size(); i++) {
44 int sign =
sgn((*
this)[i].eval(t));
53 unsigned n_roots_between(
double l,
double r) {
54 return count_signs(l) - count_signs(r);
int sgn(const T &x)
Definition: utils.h:45