Developer documentation

subdivisor_uv_binary.hpp
Go to the documentation of this file.
1 /*****************************************************************************
2  * M a t h e m a g i x
3  *****************************************************************************
4  * cell for univariate bernstein equation
5  * 2008-05-16
6  *****************************************************************************
7  * Copyright (C) 2010 INRIA Sophia-Antipolis
8  *****************************************************************************
9  * Comments :
10  ****************************************************************************/
11 # ifndef realroot_subdivisor_uv_binary_hpp
12 # define realroot_subdivisor_uv_binary_hpp
13 
16 # include <realroot/subdivisor.hpp>
17 
18 //====================================================================
19 namespace mmx {
20 
22 
23  static double m_eps;
24 
25  template<class Cell, class Stack>
26  static void subdivide(Cell* cl, Stack* stack);
27 
28  template<class Cell>
29  static bool reduce(Cell* cl);
30 
31  template<class Cell>
32  static bool regular(Cell* cl);
33 
34 } ;
35 
36 double uv_binary_approx::m_eps=1e-6;
37 
38 template<class Cell, class Stack> void
40 
41  Cell* left = new Cell(*cl);
42  Cell* right = new Cell(*cl);
43 
44  unsigned v=0;
45  // typename Cell::Scalar s=cl->domain().upper()-cl->domain().lower(),s0;
46 
47  typename Cell::Scalar m=(cl->domain().upper()+cl->domain().lower())/2;
48 
49  tensor::split(left->equation(), right->equation(), v);
50  left->domain().upper()=m;
51  right->domain().lower()=m;
52 
53  // std::cout<<"==> "<<left->equation(0)<< " "<<left->domain(0)<<std::endl;
54  // std::cout<<"==> "<<right->equation(0)<< " "<<right->domain(0)<<std::endl;
55  // std::cout<<std::endl;
56 
57  st->push(left);
58  st->push(right);
59 };
60 
61 template<class Cell> bool
63  if(cl->size() < m_eps) return false;
64  if(!has_sign_variation(cl->equation())) return false;
65  return true;
66 }
67 
68 template<class Cell> bool
70  if(!has_sign_variation(cl->equation())) return false;
71  return true;
72 }
73 
74 //--------------------------------------------------------------------
76 
77  template<class Cell>
78  static bool reduce(Cell* cl);
79 
80 } ;
81 
82 template<class Cell> bool
84  if(cl->size() < m_eps) return false;
85  if(!has_sign_variation(cl->equation())) return false;
86 
87  return true;
88 }
89 
90 //====================================================================
91 } // namespace mmx
92 //====================================================================
93 # undef TMPL
94 # undef SELF
95 # endif
static double m_eps
Definition: subdivisor_uv_binary.hpp:23
Definition: subdivisor_uv_binary.hpp:75
static bool reduce(Cell *cl)
Definition: subdivisor_uv_binary.hpp:83
static bool reduce(Cell *cl)
Definition: subdivisor_uv_binary.hpp:62
Definition: subdivisor_uv_binary.hpp:21
TMPL void split(Polynomial &r, Polynomial &p, int v)
Definition: polynomial_fcts.hpp:193
#define Scalar
Definition: polynomial_operators.hpp:12
static void subdivide(Cell *cl, Stack *stack)
Definition: subdivisor_uv_binary.hpp:39
#define Stack
Definition: subdivisor.hpp:19
bool has_sign_variation(Iterator b, Iterator e)
Definition: sign_variation.hpp:84
Definition: array.hpp:12
static bool regular(Cell *cl)
Definition: subdivisor_uv_binary.hpp:69
Home