Developer documentation

solver.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): B. Mourrain, GALAAD, INRIA
4  ********************************************************************/
5 # ifndef realroot_solver_hpp
6 # define realroot_solver_hpp
7 # include <realroot/subdivisor.hpp>
8 //====================================================================
56 //====================================================================
57 namespace mmx {
58 
59 #define solver_default_precision 20
60 
61  template<class C, class MTH> struct solver_of {
62  typedef typename MTH::Cell Cell;
63  typedef typename MTH::Strategy Strategy;
64  typedef typename MTH::Solutions Solutions;
65 
66  } ;
67 
68  template<class C,class M> struct solver {
70  typedef typename MTH::Cell Cell;
71  typedef typename MTH::Strategy Strategy;
72  typedef typename MTH::Solutions Solutions;
73 
74  template<class POL> static Solutions
75  solve(const POL& p) {
76  Cell* c = new Cell(p);
78  slv.run();
79  return slv.solutions();
80  }
81 
82  template<class POL, class DOM> static Solutions
83  solve(const POL& p, const DOM& dmn) {
84  Cell* c = new Cell(p,dmn);
86  slv.run();
87  return slv.solutions();
88  }
89  };
90 
91  struct Isolate
92  {
93  static const bool isole=true;
94  };
95  struct Approximate
96  {
97  static const bool isole=false;
98  double eps;
99  Approximate(): eps(1e-6) {}
100  Approximate(double e): eps(e) {}
101  };
102 
103  // template<class R, class MTH> struct solver;
104 
105  template<class POL, class SLV> typename solver<typename POL::Scalar,SLV>::Solutions
106  solve(const POL& p, const SLV& s) {
107  typedef solver<typename POL::Scalar,SLV> solver_t;
109  solver_t::solve(sol,p);
110  return sol;
111  }
112 
113  template<class POL, class SLV>
114  typename solver<typename POL::Scalar,SLV>::Solutions
115  solve(const POL& p, SLV& s) {
116  typedef solver<typename POL::Scalar,SLV> solver_t;
118  solver_t::solve(sol,p);
119  return sol;
120  }
121 
122 
123  template<class POL,class SLV,class Domain>
124  typename solver<typename POL::Scalar,SLV>::Solutions
125  solve(const POL& p, const SLV& s, const Domain& D) {
126  typedef solver<typename POL::Scalar,SLV> solver_t;
128  solver_t::solve(sol,p,D);
129  return sol;
130  }
131 
132  template<class POL,class SLV,class Domain1, class Domain2>
133  typename solver<typename POL::Scalar,SLV>::Solutions
134  solve(const POL& p, const SLV& s, const Domain1& D1, const Domain2& D2) {
135  typedef solver<typename POL::Scalar,SLV> solver_t;
137  solver_t::solve(sol,p,D1,D2);
138  return sol;
139  }
140 
141 
142 }
143 //====================================================================
144 #endif //realroot_solver_hpp
solver_of< C, M > MTH
Definition: solver.hpp:69
static Solutions solve(const POL &p)
Definition: solver.hpp:75
Seq< Cell * > solutions()
Definition: subdivisor.hpp:33
Definition: subdivisor.hpp:24
solver< typename POL::Scalar, SLV >::Solutions solve(const POL &p, const SLV &s, const Domain1 &D1, const Domain2 &D2)
Definition: solver.hpp:134
Approximate()
Definition: solver.hpp:99
Seq< typename ContFrac< NT, LB >::root_t > solve(const typename ContFrac< NT >::Poly &f, ContFrac< NT, LB >)
Definition: contfrac.hpp:164
MTH::Solutions Solutions
Definition: solver.hpp:64
MTH::Strategy Strategy
Definition: solver.hpp:63
static const bool isole
Definition: solver.hpp:93
void run(void)
Definition: solver.hpp:95
double eps
Definition: solver.hpp:98
static Solutions solve(const POL &p, const DOM &dmn)
Definition: solver.hpp:83
Definition: solver.hpp:68
MTH::Cell Cell
Definition: solver.hpp:62
TMPL POL
Definition: polynomial_dual.hpp:74
MTH::Strategy Strategy
Definition: solver.hpp:71
Definition: solver.hpp:61
Approximate(double e)
Definition: solver.hpp:100
const C & c
Definition: Interval_glue.hpp:45
MTH::Solutions Solutions
Definition: solver.hpp:72
static const bool isole
Definition: solver.hpp:97
Definition: solver.hpp:91
Definition: array.hpp:12
MTH::Cell Cell
Definition: solver.hpp:70
Home