1
#ifndef LIB2GEOM_STURM_HEADER
2
#define LIB2GEOM_STURM_HEADER
9
class sturm : public std::vector<Poly>{
11
sturm(Poly const &X) {
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) {
31
unsigned n_signs = 0;/* Number of sign-changes */
32
const double big = 1e20; // a number such that practical polys would overflow on evaluation
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);
64
c-file-style:"stroustrup"
65
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
70
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :