Developer documentation

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