carl  24.04
Computer ARithmetic Library
MultivariateHorner.h
Go to the documentation of this file.
1  /**
2  * @file MultivariateHorner.h
3  * @author Lukas Netz
4  *
5  */
6 
7 #pragma once
8 #include <vector>
10 #include <set>
11 #include "../../MultivariatePolynomial.h"
13 #include "IntervalEvaluation.h"
15 
16 #include "../../Term.h"
17 
18 namespace carl{
19 
20 static std::map<Variable, Interval<double>> mMap = {{ Variable::NO_VARIABLE , Interval<double>(0)}};
21 
22 template<typename PolynomialType, class strategy >
23 class MultivariateHorner : public std::enable_shared_from_this<MultivariateHorner<PolynomialType, strategy >> {
24 
25 /**
26 * Datastructure to save Polynomes once they are transformed into a horner scheme:
27 *
28 * h = Variable * h_dependent + h_independent || Variable * const_dependent + const_independent || Variable * h_dependent + const_independent
29 *
30 */
31 
32 
33 private:
34  typedef typename PolynomialType::CoeffType CoeffType;
35 
39  unsigned mExponent = 1;
40  std::shared_ptr<MultivariateHorner> mH_dependent;
41  std::shared_ptr<MultivariateHorner> mH_independent;
42 
43 
44 public:
45 
46  //Constuctor
47  MultivariateHorner () = delete;
48  MultivariateHorner (const PolynomialType& inPut);
49  MultivariateHorner (const PolynomialType& inPut, const std::map<Variable, Interval<double>>& map);
50  MultivariateHorner (const PolynomialType& inPut, const std::map<Variable, Interval<double>>& map, int& counter);
51  MultivariateHorner ( const MultivariateHorner& ) = default;
52 #ifdef __VS
54  {
55  mConst_dependent = multiHorner.mConst_dependent;
56  mConst_independent = multiHorner.mConst_independent;
57  mVariable = multiHorner.mVariable;
58  mExponent = multiHorner.mExponent;
59  mH_dependent = multiHorner.mH_dependent;
60  mH_independent = multiHorner.mH_independent;
61  }
62 #else
64 #endif
65 // MultivariateHorner& operator=(MultivariateHorner&& mh) = delete;
66 
67 
68  //~MultivariateHorner ();
69 
71 
72 /*
73  MultivariateHorner& operator=(MultivariateHorner&& mh)
74  {
75  mConst_dependent = std::move(mh.mConst_dependent);
76  mConst_independent = std::move(mh.mConst_independent);
77 
78  mH_dependent = std::move(mh.mH_dependent);
79  mH_independent = std::move(mh.mH_independent);
80 
81  mVariable = mh.mVariable;
82  mExponent = mh.mExponent;
83  return *this;
84  }
85 */
86 
87  //getter and setters
89  {
90  return mVariable;
91  }
92 
94  {
95  mVariable = var;
96  }
97 
98  std::shared_ptr<MultivariateHorner> getDependent() const
99  {
100  return mH_dependent;
101  }
102 
104  {
105  mH_dependent = NULL;
106  }
107 
109  {
110  mH_independent = NULL;
111  }
112 
113  void setDependent(std::shared_ptr <MultivariateHorner> dependent)
114  {
115 
116  mH_dependent = dependent;
117  }
118 
119  std::shared_ptr<MultivariateHorner> getIndependent() const
120  {
121  return mH_independent;
122  }
123 
124  void setIndependent(std::shared_ptr <MultivariateHorner> independent)
125  {
126  mH_independent = independent;
127  }
128 
129  const CoeffType& getDepConstant() const
130  {
131  return mConst_dependent;
132  }
133 
134  void setDepConstant(const CoeffType& constant)
135  {
136  mConst_dependent = constant;
137  }
138 
140  {
141  return mConst_independent;
142  }
143 
144  void setIndepConstant(const CoeffType& constant){
145  mConst_independent = constant;
146  }
147 
148  unsigned getExponent() const
149  {
150  return mExponent;
151  }
152 
153  void setExponent(const unsigned& exp){
154  mExponent = exp;
155  }
156 
157 }; //Class MultivarHorner
158 
159 }//namespace carl
160 #include "MultivariateHorner.tpp"
161 
162 
carl is the main namespace for the library.
Interval< Number > exp(const Interval< Number > &i)
Definition: Exponential.h:10
static std::map< Variable, Interval< double > > mMap
A Variable represents an algebraic variable that can be used throughout carl.
Definition: Variable.h:85
static const Variable NO_VARIABLE
Instance of an invalid variable.
Definition: Variable.h:203
void setDepConstant(const CoeffType &constant)
const CoeffType & getIndepConstant() const
const CoeffType & getDepConstant() const
MultivariateHorner(const PolynomialType &inPut, const std::map< Variable, Interval< double >> &map)
PolynomialType::CoeffType CoeffType
Datastructure to save Polynomes once they are transformed into a horner scheme:
void setExponent(const unsigned &exp)
void setIndepConstant(const CoeffType &constant)
std::shared_ptr< MultivariateHorner > getIndependent() const
std::shared_ptr< MultivariateHorner > mH_dependent
std::shared_ptr< MultivariateHorner > mH_independent
MultivariateHorner(const MultivariateHorner &)=default
std::shared_ptr< MultivariateHorner > getDependent() const
void setDependent(std::shared_ptr< MultivariateHorner > dependent)
MultivariateHorner(const PolynomialType &inPut)
MultivariateHorner(const PolynomialType &inPut, const std::map< Variable, Interval< double >> &map, int &counter)
void setIndependent(std::shared_ptr< MultivariateHorner > independent)
MultivariateHorner & operator=(const MultivariateHorner &mh)=default
MultivariateHorner(MultivariateHorner &&)=default
void setVariable(Variable::Arg &var)
Variable getVariable() const