6 #ifndef realroot_solver_binary_hpp
7 #define realroot_solver_binary_hpp
26 template<
typename T,
typename F>
28 static inline T
cv (
const F& x) {
return x; }
31 template<
typename T,
typename F>
inline
37 template<
class C,
int N>
struct Interval;
64 return (m << (b.
e-e)) == b.
m;
66 return (b.
m << (e-b.
e)) ==
m;
99 data_t(
bool isl): eps(1e-6), isole(isl) { m_data = 0; };
100 data_t(
const creal_t& e): eps(e) { m_data = 0; };
115 void alloc( sz_t s, sz_t cs, sz_t deep )
120 m_data =
new creal_t [ cs*
m_limit ];
126 inline const bound&
bcka()
const {
return m_res.back().a; };
128 inline const bound&
bckb()
const {
return m_res.back().b; };
131 inline bool&
bckt() {
return m_res.back().t; };
132 inline bool bckt()
const {
return m_res.back().t; };
134 inline int &
bcks() {
return m_res.back().sv; };
135 inline int bcks()
const {
return m_res.back().sv; };
150 m_res.push_back(
res_t());
197 sz_t
size()
const {
return m_res.size(); };
203 std::cout <<
"Domaine-" << d << std::endl;
204 std::cout <<
"\thauteur = " << m_dmn[d].
e << std::endl;
205 std::cout <<
"\tvaleur = " << m_dmn[d].
m << std::endl;
210 std::cout <<
"Back " << std::endl;
211 std::cout <<
"\tA = " <<
bcka().
e <<
" , " <<
bcka().
m << std::endl;
212 std::cout <<
"\tB = " <<
bckb().
e <<
" , " <<
bckb().
m << std::endl;
217 template<
class real>
static
219 const real & first = 0,
const real &
scale = 1 )
225 for (
unsigned i = 0; i < b.
e + 1; x /= 2, i ++ )
232 template<
class real,
class coeff>
239 real x = H.
a, y = -H.
c;
240 for (
unsigned i = 0; i < b.
e + 1; x /= 2, y/=2, i ++ )
242 if ( m & 1 ) {a += x; d+=y;}
249 a = real(root_bound);
268 typedef typename K::ieee
C;
281 static void split( creal_t * r, creal_t * l, sz_t sz )
285 for ( er = r + (sz-1); er != r; er--, l++ )
288 for ( p = r; p != er; p ++ )
294 static sz_t
sgncnt ( creal_t
const *
b , sz_t sz )
296 creal_t
const * last = b + sz;
298 int prv = (((*b>0)<<1)|(*b<0));
300 for ( c = 0; b != last && c<2; crr = (((*b>0)<<1)|(*b<0)), c += prv != crr, prv = crr, b ++ ) ;
318 for ( sz_t i = 0; i < n-1; i ++ )
319 std::cout << p[i] <<
",";
320 std::cout << p[n-1] <<
" ]";
326 creal_t * pup, * pdw;
334 for( a = 0, d = 0; d >= 0; d--, a -= s )
339 if ( isole && cup == 1 ) { data.
sstore(d);
continue; };
346 if ( *(pup+a+s-1) == 0 )
359 split(pup+a,pup+a+s,s);
369 template<
class output>
372 unsigned s = o.size();
373 o.resize( s + o.size() );
374 for ( sz_t i = 0; i < data.
m_res.size(); o[s+i] = data.
m_res[i++].t )
378 template<
class input>
382 data.
alloc(in.size(),prec);
389 template <
class K> data_t binary_subdivision<K>::data;
392 #endif //realroot_solver_binary_hpp
static void convert(real &a, const bound &b, const real &first=0, const real &scale=1)
Definition: solver_binary.hpp:218
void mstore(int d, int sv)
Definition: solver_binary.hpp:190
const C & b
Definition: Interval_glue.hpp:25
static hdw_int reverse(hdw_int a)
Definition: numerics_hdwi.hpp:54
const bound & bckb() const
Definition: solver_binary.hpp:128
int sv
Definition: solver_binary.hpp:80
unsigned e
Definition: solver_binary.hpp:53
void run_loop(const input &in, const creal_t &eps, bool isole, texp::false_t)
Definition: solver_binary.hpp:379
Definition: solver_binary.hpp:51
void scale(IntervalData< RT, Poly > &ID, const RT &a)
Definition: contfrac_intervaldata.hpp:221
void sstore(int d, int t=1)
Definition: solver_binary.hpp:154
void estore(int d, int t=1)
Definition: solver_binary.hpp:178
real a
Definition: homography.hpp:17
bigunsigned< bitquo+(sz_t)(bitrem!=0)> unsigned_t
Definition: solver_binary.hpp:275
K::integer integer
Definition: solver_binary.hpp:265
void pshbck()
Definition: solver_binary.hpp:148
int bcks() const
Definition: solver_binary.hpp:135
bool operator==(const bound &b)
Definition: solver_binary.hpp:60
bound a
Definition: solver_binary.hpp:77
static void print(creal_t *p, sz_t n)
Definition: solver_binary.hpp:315
bound & bcka()
Definition: solver_binary.hpp:127
bound * m_dmn
Definition: solver_binary.hpp:89
creal_t root_bound
Definition: solver_binary.hpp:94
void bstore(int d, int t=1)
Definition: solver_binary.hpp:166
K::rational rational
Definition: solver_binary.hpp:266
static T cv(const F &x)
Definition: solver_binary.hpp:28
C creal_t
Definition: solver_binary.hpp:276
void setbck(const bound &a, const bound &b, bool type)
Definition: solver_binary.hpp:140
void writebck()
Definition: solver_binary.hpp:208
double creal_t
Definition: solver_binary.hpp:84
sz_t m_cdw
Definition: solver_binary.hpp:93
real c
Definition: homography.hpp:17
K::floating floating
Definition: solver_binary.hpp:267
T as(const F &x)
Definition: assign.hpp:51
Definition: numerics_hdwi.hpp:20
void writedomain(int d)
Definition: solver_binary.hpp:201
TMPL void copy(Polynomial &r, const Polynomial &a)
Copy of a in r.
Definition: sparse_monomials.hpp:613
void get_flags(output &o)
Definition: solver_binary.hpp:370
bool in(const T &x, const Interval< T, r > &y)
Definition: Interval_fcts.hpp:100
creal_t eps
Definition: solver_binary.hpp:94
static const sz_t bitrem
Definition: solver_binary.hpp:273
data_t(const creal_t &e)
Definition: solver_binary.hpp:100
#define min(a, b)
Definition: parser_def.c:475
data_t()
Definition: solver_binary.hpp:98
#define Interval
Definition: Interval_glue.hpp:8
unsigned m
Definition: solver_binary.hpp:54
void set_back_a(const bound &a)
Definition: solver_binary.hpp:137
unsigned unsigned_t
Definition: solver_binary.hpp:86
void set_back_b(const bound &b)
Definition: solver_binary.hpp:138
sz_t m_limit
Definition: solver_binary.hpp:90
unsigned sz_t
Definition: solver_binary.hpp:270
sz_t m_s
Definition: solver_binary.hpp:91
bool t
Definition: solver_binary.hpp:79
Definition: homography.hpp:15
static void split(bound &r, bound &l)
Definition: solver_binary.hpp:305
~data_t()
Definition: solver_binary.hpp:101
sz_t size() const
Definition: solver_binary.hpp:197
Definition: numerics_hdwi.hpp:47
Definition: solver_binary.hpp:76
bound b
Definition: solver_binary.hpp:78
unsigned sz_t
Definition: solver_binary.hpp:85
real b
Definition: homography.hpp:17
Definition: solver_binary.hpp:83
sz_t nb_sol()
Definition: solver_binary.hpp:198
unsigned bitprec(const T &e, const T &l=T(1.0))
Definition: numerics_hdwi.hpp:29
creal_t get_root_bound()
Definition: solver_binary.hpp:215
static const sz_t bitquo
Definition: solver_binary.hpp:272
Definition: solver_binary.hpp:263
const C & c
Definition: Interval_glue.hpp:45
bool & bckt()
Definition: solver_binary.hpp:131
bool bckt() const
Definition: solver_binary.hpp:132
structure defining a negative answer
Definition: texp_bool.hpp:9
sz_t m_cup
Definition: solver_binary.hpp:92
bool isole
Definition: solver_binary.hpp:95
static data_t data
Definition: solver_binary.hpp:278
static sz_t sgncnt(creal_t const *b, sz_t sz)
Definition: solver_binary.hpp:294
Definition: scalar_bigunsigned.hpp:11
bound & bckb()
Definition: solver_binary.hpp:129
std::vector< res_t > m_res
Definition: solver_binary.hpp:96
void Free()
Definition: solver_binary.hpp:104
int & bcks()
Definition: solver_binary.hpp:134
void Loop(bool isole=true)
Definition: solver_binary.hpp:323
void convert(real &a, const bound &b, const homography< coeff > &H)
Definition: solver_binary.hpp:233
K::ieee C
Definition: solver_binary.hpp:268
void alloc(sz_t s, sz_t cs, sz_t deep)
Definition: solver_binary.hpp:115
const bound & bcka() const
Definition: solver_binary.hpp:126
real d
Definition: homography.hpp:17
creal_t * m_data
Definition: solver_binary.hpp:88
static void split(creal_t *r, creal_t *l, sz_t sz)
Definition: solver_binary.hpp:281
data_t(bool isl)
Definition: solver_binary.hpp:99