Developer documentation

solver_uv_sleeve.hpp
Go to the documentation of this file.
1 /*******************************************************************
2  * This file is part of the source code of the realroot kernel.
3  * Author(s): J.P. Pavone GALAAD, INRIA
4  * B. Mourrain GALAAD, INRIA
5  ********************************************************************/
6 #ifndef realroot_solver_sleeve_hpp
7 #define realroot_solver_sleeve_hpp
8 /********************************************************************/
60 //====================================================================
61 # include <realroot/IEEE754.hpp>
62 # include <realroot/texp_bool.hpp>
63 # include <realroot/array.hpp>
64 # include <realroot/solver.hpp>
68 
69 # define TMPL template<class C, class V>
70 # define SOLVER solver<C, Sleeve<V> >
71 //====================================================================
72 namespace mmx {
73 template<class V> struct Sleeve{};
74 
75 template<class C>
76 struct sleeve_rep {
77  C *up, *dw;
78  unsigned m_sz;
79 
80  sleeve_rep(unsigned n): up(new C[n]), dw(new C[n]), m_sz(n) {};
81  unsigned size() const { return m_sz; }
82 };
83 
84 struct Monomials;
85 struct Bernstein;
86 namespace let {
87 template<class C, class D> void
89  assert(f.size()==(unsigned)(degree(p)+1));
90  {
91  numerics::rounding<C> rnd(numerics::rnd_up());
92  for(unsigned i=0;i<f.size();i++) f.up[i]=as<C>(p[i]);
93  }
94  {
95  numerics::rounding<C> rnd(numerics::rnd_dw());
96  for(unsigned i=0;i<f.size();i++) f.dw[i]=as<C>(p[i]);
97  }
98 }
99 template<class C, class D> void
101  assert(f.size()==(unsigned)(degree(p)+1));
102  typedef typename kernelof<D>::T::integer integer;
103  typedef typename kernelof<D>::T::rational rational;
104 
106  unsigned ip=0, in=0;
107  int d=degree(p);
108  for(unsigned i=0;i< p.size();i++) {
109  if(p[i]>p[ip]) {
110  ip = i;
111  }
112  if(p[i]<p[in]) in=i;
113  }
114  rational mx = (p[ip]>-p[in]?as<rational>(p[ip]):as<rational>(-p[in]));
115  rational c;
116  {
117  numerics::rounding<C> rnd( numerics::rnd_up() );
118  for ( int i = 0; i <= d; i ++ ) {
119  c = as<rational>(p[i])/(mx*bn(d,i));
120  f.up[i]=as<C>(c);
121  }
122  }
123  {
124  numerics::rounding<C> rnd( numerics::rnd_dw() );
125  for ( int i = 0; i <= d; i ++ ) {
126  c = as<rational>(p[i])/(mx*bn(d,i));
127  f.dw[i]=as<C>(c);
128  }
129  }
130  // polynom< ring<rational,Bernstein> > q;
131  // let::assign(q,p);
132  // assign(f,q);
133 }
134 
135 }
136 //====================================================================
137 template<class K, class Num> struct binary_convert {};
138 template<class K>
139 struct binary_convert<K,Isolate>: public K {
140 
142  static data_t data;
143 
144  template<class output, class real> static inline
145  void get(output& sol, const real& first = 0, const real& last =1)
146  {
147  typedef typename output::value_type root_t;
148  //typedef root_t as_root;
149  // unsigned s = o.size();
150  real a,b;
151  // o.resize(s+2*size());
152  real scale = last-first;
153  for ( unsigned i = 0; i < data.nb_sol(); i ++ )
154  {
155  data_t::convert(a,data.m_res[i].a,first, scale);
156  data_t::convert(b,data.m_res[i].b,first, scale);
157  sol << as<root_t>(Interval<real>(a,b));
158  };
159  };
160 
161  template<class output, class real> static inline
162  void get(output & sol, const homography<real>& H)
163  {
164  typedef typename output::value_type root_t;
165  typedef root_t as_root;
166  typedef typename root_t::value_type bound_t;
167  // unsigned s = o.size();
168  bound_t u,v;
169  real dt= H.a*H.d-H.b*H.c;
170  if(dt>0)
171  for (unsigned i = 0; i < data.nb_sol(); i ++ )
172  {
173  data.convert(u,data.m_res[i].a,H);
174  data.convert(v,data.m_res[i].b,H);
175  sol << as_root(u,v);
176  }
177  else
178  for ( int i = data.nb_sol()-1; i >=0 ; i --)
179  {
180  data.convert(u,data.m_res[i].b,H);
181  data.convert(v,data.m_res[i].a,H);
182  sol << as_root(u,v);
183  }
184  }
185 };
186 template <class K> data_t binary_convert<K,Isolate>::data(true);
187 //====================================================================
188 template<class K>
189 struct binary_convert<K,Approximate> : public K
190 {
191  typedef unsigned unsigned_t;
193  typedef typename K::integer integer;
194  static data_t data;
195 
196  static inline
197  integer binomial(const integer& n,const integer& p){return K::binomial(n,p);}
198 
199  template<class C> static inline C as_root(const C& a, const C& b) {return (a+b)/2;}
200 
201  template<class output, class real> static inline
202  void get(output& sol, const real& first = 0, const real& last =1)
203  {
204  typedef typename output::value_type root;
205  real a,b;
206  real scale= last-first;
207  for (unsigned i = 0; i < data.nb_sol(); i ++ )
208  {
209  data_t::convert(a,data.m_res[i].a, first, scale);
210  data_t::convert(b,data.m_res[i].b, first, scale);
211  sol << as<root>(Interval<real>(a,b));
212  }
213  }
214 
215  template<class output, class real> static inline
216  void get(output& sol, std::vector<int>& mults, const real& first = 0, const real& last =1)
217  {
218  get(sol, first, last);
219  for (unsigned i = 0; i < data.nb_sol(); i ++ )
220  mults.push_back(data.m_res[i].sv);
221  }
222 
223  template<class output, class real> static inline
224  void get(output& sol, const homography<real>& H)
225  {
226  // typedef typename output::value_type as_root;
227  //root_t u,v;
228  unsigned s=data.nb_sol();
229  std::vector<real> u(s);
230  real v;
231  real dt=H.a*H.d-H.b*H.c;
232 
233  if(dt>0)
234  {
235  {
236  numerics::rounding<real> rnd(numerics::rnd_dw());
237  for ( unsigned i = 0; i < s; i ++ )
238  data.convert(u[i],data.m_res[i].a,H);
239  }
240  {
241  numerics::rounding<real> rnd(numerics::rnd_up());
242  for ( unsigned i = 0; i < s; i ++ ) {
243  data.convert(v,data.m_res[i].b,H);
244  sol << as_root(u[i],v);
245  }
246  }
247  }
248  else
249  {
250  {
251  numerics::rounding<real> rnd(numerics::rnd_dw());
252  for (int i = s-1; i >=0; i -- )
253  data.convert(u[i],data.m_res[i].a,H);
254  }
255  {
256  numerics::rounding<real> rnd(numerics::rnd_up());
257  for (int i = s-1; i >=0; i -- ) {
258  data.convert(v,data.m_res[i].b,H);
259  sol << as_root(v,u[i]);
260  }
261  }
262  }
263  }
264 
265 };
266 
267 template <class K> data_t binary_convert<K,Approximate>::data(false);
268 
269 //====================================================================
271 template < class K>
272 struct binary_sleeve_subdivision : public K {
273 
274  typedef typename K::integer integer;
275  typedef typename K::rational rational;
276  // typedef typename K::floating floating;
277  // typedef typename K::ieee ieee;
278 
279  typedef double creal_t;
280  typedef unsigned sz_t;
282  typedef typename Base_t::unsigned_t unsigned_t;
283  typedef res_t Domain_t;
284 
285  // sleeve(): Base_t(1e-6){}
286  // sleeve(creal_t e): Base_t(e){}
287 
288  static inline void alloc( sz_t s, sz_t deep )
289  {
290  K::data.alloc(s,2*s,deep);
291  };
292 
293  static void barre( char c, unsigned n )
294  {
295  char _bar[ n+1 ];
296  std::fill(_bar,_bar+n, c);
297  _bar[n] = 0;
298  std::cout << _bar << std::endl;
299  };
300 
301  static void writebounds( creal_t * pup, creal_t * pdw, unsigned s )
302  {
303  Base_t::print(pup,s); std::cout << std::endl;
304  Base_t::print(pdw,s); std::cout << std::endl;
305  };
306 
307  static inline
308  bool glue( sz_t cup, sz_t cdw, int d )
309  {
310  if ( K::data.bckb() == K::data.m_dmn[d] )
311  {
312  K::data.bckb() = K::data.m_dmn[d];
313  K::data.bckb().m += 1;
314  if ( cup ) K::data.m_cup = cup;
315  if ( cdw ) K::data.m_cdw = cdw;
316  return true;
317  };
318  return false;
319  };
320 
321  static inline
322  void mstore( sz_t cup, sz_t cdw, int d )
323  {
324  if ( K::data.m_res.size() == 0 || !glue(cup,cdw,d) )
325  {
326  K::data.mstore(d, std::max(cup,cdw));
327  K::data.m_cup = cup;
328  K::data.m_cdw = cdw;
329  //std::cout << "Push ";
330  };
331  // writebck();
332  };
333 
334 
335  static inline
336  void dwsplit( creal_t * r, creal_t * l, sz_t s )
337  {
338  numerics::rounding<creal_t> rnd( numerics::rnd_dw() );
339  Base_t::split(r,l,s);
340  };
341 
342  static inline
343  void upsplit( creal_t * r, creal_t * l, sz_t s )
344  {
345  numerics::rounding<creal_t> rnd( numerics::rnd_up() );
346  Base_t::split(r,l,s);
347  };
348 
349  static void Loop( bool isole = true ) {
350  // std::cout << "LOOP\n";
351  numerics::rounding<creal_t> rnd(numerics::rnd_dw());
352  creal_t * pup, * pdw;
353  int d;
354  sz_t a,s,cup,cdw;
355  // unsigned_t v;
356  s = K::data.m_s;
357  pup = K::data.m_data;
358  pdw = K::data.m_data + s;
359  K::data.m_dmn[0].m = 0;
360  K::data.m_dmn[0].e = 0;
361  for( a = 0, d = 0; d >= 0; d--, a -= 2*s )
362  {
363  cup = Base_t::sgncnt(pup+a,s);
364  cdw = Base_t::sgncnt(pdw+a,s);
365  if ( cup || cdw )
366  {
367  if ( isole && cup == cdw && cup == 1 ){
368  //std::cout << " (b) \n";
369  K::data.sstore(d);
370  continue;
371  };
372  if ( K::data.m_dmn[d].e == K::data.m_limit-1 ) {
373  // std::cout << " (c) "<<cup<<" "<<cdw<<"\n";
374  if ( cup == cdw && cup == 1 )
375  K::data.sstore(d);
376  else
377  mstore(cup,cdw,d);
378  continue;
379  };
380  dwsplit(pdw+a,pdw+a+2*s,s);
381  upsplit(pup+a,pup+a+2*s,s);
382  Base_t::split(K::data.m_dmn[d],K::data.m_dmn[d+1]);
383  d += 2;
384  a += 4*s;
385  continue;
386  } else {
387  //std::cout<<" (a) ";
388  sz_t k =0, sv=0;
389  for ( k = 0; k < K::data.m_s; k ++ ) {
390  if ( ( pup[a+k] > 0 ) != ( pdw[a+k] > 0 ) ) {
391  sv++;
392  if(sv>1) {
393  mstore(cup,cdw,d);
394  break;
395  };
396  }
397  }
398  //std::cout<<std::endl;
399  };
400  };
401  // std::cout << "END LOOP\n";
402  };
403 
404 
405  template<class input> static
406  void run_loop( const input& in, const creal_t& eps, const texp::true_t& ) {
407  // binary_subdivision<K> slv(eps);
408  sz_t prec = numerics::bitprec(eps);
409  alloc(in.size(),prec);
410  std::copy(in.begin(),in.end(),K::data.m_data);
411  std::copy(in.begin(),in.end(),K::data.m_data+K::data.m_s);
412  Loop(K::data.isole);
413  };
414 
415  const Domain_t& operator[]( int i ) const { return K::data.m_res[i]; };
416  Domain_t& operator[]( int i ) { return K::data.m_res[i]; };
417 
418 
419  template<class output, class input> static inline
420  void solve_bernstein( output& out, const input& in) {
421  run(in,K::data.eps);
422  // solutions<typename output::value_type>::get(this,out);
423  }
424  template<class VECT,class POL,class Q> static inline
425  void init_pol(VECT& ubp, VECT& dbp, const POL& r, unsigned sz, const Q& u, const Q&v);
426 
427 
428  template<class input> static inline
429  void run( const input& in, const creal_t& eps)
430  {
431  typedef typename numerics::is_rounded<creal_t>::result_t round_t;
432  run_loop(in,eps,round_t());
433  }
434 
435  template<class C> static void
436  run( const sleeve_rep<C>& p) {
437  sz_t prec = numerics::bitprec(K::data.eps);
438  alloc(p.size(),prec);
439  std::copy(p.up,p.up+p.size(),K::data.m_data);
440  std::copy(p.dw,p.dw+p.size(),K::data.m_data+K::data.m_s);
441  Loop(K::data.isole);
442  }
443 
444  template<class input> static
445  void run( const input& up, const input& dw) {
446  assert(up.size()==dw.size());
447  sz_t prec = numerics::bitprec(K::data.eps);
448  alloc(up.size(),prec);
449  std::copy(up.begin(),up.end(),K::data.m_data);
450  std::copy(dw.begin(),dw.end(),K::data.m_data+K::data.m_s);
451  Loop(K::data.isole);
452  }
453 
459  template <typename output, typename POL, typename Q> static
460  void solve(output& sol, const POL& r, const Q& u, const Q& v);
461 
462  //--------------------------------------------------------------------
463  template<class output, class input,class real,class MTH> static inline
464  void solve_bernstein( output& sol,
465  const input& up, const input& dw,
466  const real& u, const real& v, const MTH& mth)
467  {
468  K::data.isole=mth.isole;
469  run(up,dw);
470  get(sol,u,v);
471  // solutions<typename output::value_type>::get(this,out,u,v);
472  }
473 
474  //--------------------------------------------------------------------
480  template <typename output, typename POL ,typename real, typename MTH> static
481  void solve_bernstein(output& sol, const POL& r, const real& u,const real& v, const MTH& mth )
482  {
483  //typedef typename output::value_type root_t;
484  using let::assign;
485 
486  unsigned sz= r.size();
487  std::vector<creal_t> ubp( sz ), dbp( sz );
488  {
489  numerics::rounding<creal_t> rnd( numerics::rnd_up() );
490  for(unsigned i=0;i<sz;i++) ubp[i] =as<creal_t>(r[i]);
491  }
492  {
493  numerics::rounding<creal_t> rnd( numerics::rnd_dw() );
494  for(unsigned i=0;i<sz;i++) dbp[i] =as<creal_t>(r[i]);
495  }
496  K::data.isole=mth.isole;
497  run(ubp,dbp);
498  get(sol,u,v);
499  // solutions<typename output::value_type>::get(this, sol, u,v);
500  }
501 };
502 //====================================================================
503 template<class K>
504 template<class VECT,class POL,class Q>
505 void binary_sleeve_subdivision<K>::init_pol(VECT& ubp, VECT& dbp, const POL& r, unsigned sz,const Q& u, const Q&v)
506 {
507  using let::assign;
508 
509 #if 1
510  // PRINT_DEBUG("Conversion using exact arithmetic");
511  rational U,V;
512  assign(U,u);
513  assign(V,v);
514  // std::vector<interval> bp( sz );
515  std::vector<rational> bp(sz);
516  univariate::convertm2b(bp,r,sz,U,V);
517  rational mx = array::max_abs(bp);
518  array::div(bp,mx);
519  // unsigned i;
520  // for (i = 0; i < sz && bp[i].upper()-bp[i].lower()<as<floating>(1.e-16); i ++ );
521  // if(i<sz) std::cout<<"refine: "<<i<<" " <<(bp[i].upper()-bp[i].lower())<<std::endl;
522  // double l; assign(l, rational(V-U));
523  // std::cout<<"\t init: "<<sign_variation(bp)<<" "<<l<<std::endl;
524  {
525  numerics::rounding<creal_t> rnd( numerics::rnd_up() );
526  for ( unsigned i = 0; i < sz; i ++ ) ubp[i]=as<creal_t>(bp[i]);
527  }
528  {
529  numerics::rounding<creal_t> rnd( numerics::rnd_dw() );
530  for ( unsigned i = 0; i < sz; i ++ ) dbp[i]=as<creal_t>(bp[i]);
531  };
532 
533 #else
534  // PRINT_DEBUG("Using rounding arithmetic");
535  O ud, vd;
536  {
537  numerics::rounding<creal_t> rnd( numerics::rnd_dw() );
538  ud=as<creal_t>(u);
539  };
540  {
541  numerics::rounding<creal_t> rnd( numerics::rnd_up() );
542  vd=as<creal_t>(v);
543  BEZIER::monomial_to_bezier(ubp,r,r.size(),ud,vd);
544  };
545  {
546  numerics::rounding<creal_t> rnd( numerics::rnd_dw() );
547  BEZIER::monomial_to_bezier(dbp,r,r.size(),ud,vd);
548  };
549 
550  for ( unsigned i= 0; i < ubp.size(); i ++ )
551  if ( dbp[i] > ubp[i] ) {
552  std::swap(dbp[i], ubp[i]);
553  };
554 #endif
555 
556 }
557 //------------------------------------------------------------------
558 template <class K>
559 template <typename output, typename POL ,typename Q>
560 void binary_sleeve_subdivision<K>::solve(output& sol, const POL& r, const Q& u, const Q& v)
561 {
562  unsigned sz= r.size();
563  std::vector<double> ubp(sz), dbp(sz);
564  init_pol(ubp,dbp,r,sz,u,v);
565  run(ubp,dbp,true);
566  // run(ubp,dbp,this->eps,mth.isolate);
567  // solutions<typename output::value_type>::get(this,sol,u,v);
568 }
569 
570 //====================================================================
571 TMPL
572 struct solver<C, Sleeve<V> > {
573 
574  typedef typename kernelof<C>::T K;
576  // Seq<Interval<typename K::ieee> > Solutions;
578 
579 
580  template<class POL> static void
581  solve(Solutions& sol, const POL& p);
582 
583  template<class POL,class T> static void
584  solve(Solutions& sol, const POL& p, const T& u, const T& v);
585 
586  template<class T, class U, class VRT> static void
587  solve(Solutions& sol, const polynomial<U,VRT>& pl, const polynomial<U,VRT>& pu, const T& u, const T& v);
588 
589  template<class T, class U, class VRT> static void
590  solve(Solutions& sol, std::vector<int>& mult, const polynomial<U,VRT>& pl, const polynomial<U,VRT>& pu, const T& u, const T& v);
591 
592  template<class U,class VRT> static void
593  solve(Solutions& sol, const polynomial<U,VRT>& pl, const polynomial<U,VRT>& pu);
594 
595 
596  static inline void
598 
599 };
600 
603 TMPL
604 template<class POL> void
605  SOLVER::solve(Solutions& sol, const POL& p) {
606  typedef typename K::ieee real_t;
607  sleeve_rep<real_t> f(degree(p)+1);
608  let::assign(f,p);
609  real_t c;
610  for(unsigned i=1;i< f.size();i+=2) {
611  c=f.up[i];f.up[i]=-f.dw[i];f.dw[i]=-c;
612  }
613  base_t::run(f);
614 
615  homography<real_t> H(1,0,1,-1);
616  base_t::data.root_bound = - bound_root(p,Cauchy<real_t>());
617  base_t::get(sol,H);
618 
619  for(unsigned i=1;i< f.size();i+=2) {
620  c=f.up[i];f.up[i]=-f.dw[i];f.dw[i]=-c;
621  }
622  base_t::run(f);
623  base_t::data.root_bound = - base_t::data.root_bound;
624  H.c=-1;H.d=1;
625  base_t::get(sol,H);
626 }
627 //--------------------------------------------------------------------
628 TMPL
629 template<class T, class U, class VRT> void
630  SOLVER::solve(Solutions& sol,
631  const polynomial<U,VRT>& pl, const polynomial<U,VRT>& pu,
632  const T& u, const T& v) {
633  base_t::run(pl,pu);
634  base_t::get(sol,u,v);
635 }
636 
637 //--------------------------------------------------------------------
638 TMPL
639 template<class T, class U, class VRT> void
640  SOLVER::solve(Solutions& sol, std::vector<int>& mult,
641  const polynomial<U,VRT>& pl, const polynomial<U,VRT>& pu,
642  const T& u, const T& v) {
643  base_t::run(pl,pu);
644  base_t::get(sol,mult,u,v);
645 }
646 //--------------------------------------------------------------------
647 TMPL
648 template<class U, class VRT> void
649  SOLVER::solve(Solutions& sol,
650  const polynomial<U,VRT>& pl, const polynomial<U,VRT>& pu) {
651  base_t::run(pl,pu);
652  base_t::get(sol,0,1);
653 }
654 
655 //--------------------------------------------------------------------
656 TMPL
657 template<class POL, class T> void
658  SOLVER::solve(Solutions& sol, const POL& p,
659  const T& u, const T& v) {
660  //typedef typename POL::Ring Ring;
661  typedef typename SOLVER::base_t base_t;
662  //typedef typename SOLVER::Solutions Solutions;
663  unsigned sz= p.size();
664  std::vector<double> ubp(sz), dbp(sz);
665  base_t::init_pol(ubp,dbp,p,sz,u,v);
666  base_t::run(ubp,dbp);
667  base_t::get(sol,u,v);
668 }
669 
670 
671 //--------------------------------------------------------------------
672 template<class POL, class M, class B>
673 typename solver<B, Sleeve<M> >::Solutions
674 solve (const POL& p, const Sleeve<M>& slv, const B& u, const B& v) {
675  typedef solver<B, Sleeve<M> > Solver;
676  typedef typename Solver::Solutions Solutions;
677  Solutions sol;
678  Solver::solve(sol,p, u,v);
679  return sol;
680 }
681 //--x------------------------------------------------------------------
682 template<class POL, class M>
683 typename solver<typename POL::Scalar, Sleeve<M> >::Solutions
684 solve (const POL& p, const Sleeve<M>& slv) {
685  typedef typename POL::Scalar Scalar;
686  typedef solver<Scalar, Sleeve<M> > Solver;
687  typedef typename solver<Scalar, Sleeve<M> >::Solutions Solutions;
688  Solutions sol;
689  Solver::solve(sol,p);
690  return sol;
691 }
692 
693 } //namespace mmx
694 //====================================================================
695 # undef TMPL
696 # undef SOLVER
697 //====================================================================
698 #endif //realroot_solver_sleeve_hpp
699 
Definition: solver_uv_sleeve.hpp:272
static void run_loop(const input &in, const creal_t &eps, const texp::true_t &)
Definition: solver_uv_sleeve.hpp:406
static void run(const sleeve_rep< C > &p)
Definition: solver_uv_sleeve.hpp:436
static void convert(real &a, const bound &b, const real &first=0, const real &scale=1)
Definition: solver_binary.hpp:218
Sequence of terms with reference counter.
Definition: Seq.hpp:28
Definition: solver_uv_sleeve.hpp:73
void fill(C *a, unsigned n, int s, const C &x)
Definition: tensor_vctops.hpp:152
const C & b
Definition: Interval_glue.hpp:25
K::integer integer
Definition: solver_uv_sleeve.hpp:193
dynamic_exp< E >::degree_t degree(const dynamic_exp< E > &t)
Definition: dynamicexp.hpp:191
unsigned sz_t
Definition: solver_uv_sleeve.hpp:280
structure defining a the empty list
Definition: texp_bool.hpp:11
const Domain_t & operator[](int i) const
Definition: solver_uv_sleeve.hpp:415
static Solutions solve(const POL &p)
Definition: solver.hpp:75
binary_subdivision< K > Base_t
Definition: solver_uv_sleeve.hpp:281
static void init_pol(VECT &ubp, VECT &dbp, const POL &r, unsigned sz, const Q &u, const Q &v)
Definition: solver_uv_sleeve.hpp:505
static void run(const input &in, const creal_t &eps)
Definition: solver_uv_sleeve.hpp:429
MP swap(const MP &P, int var_i, int var_j)
Definition: sparse_monomials.hpp:988
void scale(IntervalData< RT, Poly > &ID, const RT &a)
Definition: contfrac_intervaldata.hpp:221
FT bound_root(const POLY &p, const Cauchy< FT > &m)
Definition: univariate_bounds.hpp:325
static void upsplit(creal_t *r, creal_t *l, sz_t s)
Definition: solver_uv_sleeve.hpp:343
Definition: solver_uv_sleeve.hpp:76
solver< typename POL::Scalar, Sleeve< M > >::Solutions solve(const POL &p, const Sleeve< M > &slv)
Definition: solver_uv_sleeve.hpp:684
kernelof< C >::T K
Definition: solver_uv_sleeve.hpp:574
static void run(const input &up, const input &dw)
Definition: solver_uv_sleeve.hpp:445
Seq< typename ContFrac< NT, LB >::root_t > solve(const typename ContFrac< NT >::Poly &f, ContFrac< NT, LB >)
Definition: contfrac.hpp:164
static void print(creal_t *p, sz_t n)
Definition: solver_binary.hpp:315
static void set_precision(unsigned p)
Definition: solver_uv_sleeve.hpp:597
Seq< typename K::ieee > Solutions
Definition: solver_uv_sleeve.hpp:192
Definition: rounding_mode.hpp:71
Definition: solver.hpp:95
Base_t::unsigned_t unsigned_t
Definition: solver_uv_sleeve.hpp:282
Definition: solver_uv_sleeve.hpp:137
structure defining a positive answer
Definition: texp_bool.hpp:7
static void solve_bernstein(output &out, const input &in)
Definition: solver_uv_sleeve.hpp:420
unsigned size() const
Definition: solver_uv_sleeve.hpp:81
static data_t data
Definition: solver_uv_sleeve.hpp:142
void assign(double &r, const scalar< MPF > &z)
Definition: scalar_floating.hpp:537
TMPL void copy(Polynomial &r, const Polynomial &a)
Copy of a in r.
Definition: sparse_monomials.hpp:613
static void writebounds(creal_t *pup, creal_t *pdw, unsigned s)
Definition: solver_uv_sleeve.hpp:301
static void solve_bernstein(output &sol, const POL &r, const real &u, const real &v, const MTH &mth)
Definition: solver_uv_sleeve.hpp:481
static bool glue(sz_t cup, sz_t cdw, int d)
Definition: solver_uv_sleeve.hpp:308
bool in(const T &x, const Interval< T, r > &y)
Definition: Interval_fcts.hpp:100
C * up
Definition: solver_uv_sleeve.hpp:77
sleeve_rep(unsigned n)
Definition: solver_uv_sleeve.hpp:80
static data_t data
Definition: solver_uv_sleeve.hpp:194
Definition: solver.hpp:68
Definition: polynomial.hpp:37
Seq< Interval< typename K::ieee > > Solutions
Definition: solver_uv_sleeve.hpp:141
static void mstore(sz_t cup, sz_t cdw, int d)
Definition: solver_uv_sleeve.hpp:322
int binomial(int n, int p)
Definition: fatarcs_fcts.hpp:154
static integer binomial(const integer &n, const integer &p)
Definition: solver_uv_sleeve.hpp:197
static void alloc(sz_t s, sz_t deep)
Definition: solver_uv_sleeve.hpp:288
TMPL POL
Definition: polynomial_dual.hpp:74
Definition: homography.hpp:15
Definition: solver_binary.hpp:76
static void Loop(bool isole=true)
Definition: solver_uv_sleeve.hpp:349
res_t Domain_t
Definition: solver_uv_sleeve.hpp:283
Definition: binomials.hpp:68
#define Scalar
Definition: polynomial_operators.hpp:12
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
Generic class for intervals.
Definition: Interval.hpp:44
unsigned unsigned_t
Definition: solver_uv_sleeve.hpp:191
Definition: solver_binary.hpp:263
const C & c
Definition: Interval_glue.hpp:45
static void solve(output &sol, const POL &r, const Q &u, const Q &v)
Definition: solver_uv_sleeve.hpp:560
double C
Definition: solver_mv_fatarcs.cpp:16
binary_convert< K, V >::Solutions Solutions
Definition: solver_uv_sleeve.hpp:575
K::integer integer
Definition: solver_uv_sleeve.hpp:274
static C as_root(const C &a, const C &b)
Definition: solver_uv_sleeve.hpp:199
structure defining a negative answer
Definition: texp_bool.hpp:9
void convertm2b(T &bz, const P &p, unsigned size, const C &a, const C &b)
Definition: univariate.hpp:847
static sz_t sgncnt(creal_t const *b, sz_t sz)
Definition: solver_binary.hpp:294
binary_sleeve_subdivision< binary_convert< K, V > > base_t
Definition: solver_uv_sleeve.hpp:577
static void dwsplit(creal_t *r, creal_t *l, sz_t s)
Definition: solver_uv_sleeve.hpp:336
Definition: scalar_bigunsigned.hpp:11
void div(V &a, const W &c)
Inplace scalar division.
Definition: array.hpp:334
std::vector< res_t > m_res
Definition: solver_binary.hpp:96
unsigned m_sz
Definition: solver_uv_sleeve.hpp:78
void assign(A &a, const B &b)
Generic definition of the assignement function.
Definition: assign.hpp:97
Domain_t & operator[](int i)
Definition: solver_uv_sleeve.hpp:416
Definition: solver.hpp:91
C * dw
Definition: solver_uv_sleeve.hpp:77
double creal_t
Definition: solver_uv_sleeve.hpp:279
return the arithmetic kernel from which the type X comes from.
Definition: texp_kernelof.hpp:30
static void barre(char c, unsigned n)
Definition: solver_uv_sleeve.hpp:293
Interval< T, r > max(const Interval< T, r > &a, const Interval< T, r > &b)
Definition: Interval_fcts.hpp:135
Definition: array.hpp:12
Definition: polynomial.hpp:40
R::value_type max_abs(const R &v)
Definition: array.hpp:387
K::rational rational
Definition: solver_uv_sleeve.hpp:275
static void split(creal_t *r, creal_t *l, sz_t sz)
Definition: solver_binary.hpp:281
static void solve_bernstein(output &sol, const input &up, const input &dw, const real &u, const real &v, const MTH &mth)
Definition: solver_uv_sleeve.hpp:464
#define TMPL
Definition: solver_uv_sleeve.hpp:69
#define assert(expr, msg)
Definition: shared_object.hpp:57
Home