34 #ifndef ACADO_TOOLKIT_TAYLOR_VARIABLE_HPP 35 #define ACADO_TOOLKIT_TAYLOR_VARIABLE_HPP 55 (
const unsigned int nvar,
const unsigned int nord );
63 template <
typename U,
typename V>
friend TaylorVariable<U>
operator+
64 (
const TaylorVariable<U>&,
const V& );
65 template <
typename U,
typename V>
friend TaylorVariable<U>
operator+
66 (
const V&,
const TaylorVariable<U>& );
67 template <
typename U>
friend TaylorVariable<U>
operator+
68 (
const double,
const TaylorVariable<U>& );
69 template <
typename U>
friend TaylorVariable<U>
operator+
70 (
const TaylorVariable<U>&,
const double );
71 template <
typename U>
friend TaylorVariable<U>
operator-
72 (
const TaylorVariable<U>& );
73 template <
typename U,
typename V>
friend TaylorVariable<U>
operator-
75 template <
typename U,
typename V>
friend TaylorVariable<U>
operator-
76 (
const TaylorVariable<U>&,
const V& );
77 template <
typename U,
typename V>
friend TaylorVariable<U>
operator-
78 (
const V&,
const TaylorVariable<U>& );
79 template <
typename U>
friend TaylorVariable<U>
operator-
80 (
const double,
const TaylorVariable<U>& );
81 template <
typename U>
friend TaylorVariable<U>
operator-
82 (
const TaylorVariable<U>&,
const double );
83 template <
typename U>
friend TaylorVariable<U>
operator*
84 (
const TaylorVariable<U>&,
const TaylorVariable<U>& );
85 template <
typename U>
friend TaylorVariable<U>
operator*
86 (
const double,
const TaylorVariable<U>& );
87 template <
typename U>
friend TaylorVariable<U>
operator*
88 (
const TaylorVariable<U>&,
const double );
89 template <
typename U>
friend TaylorVariable<U>
operator*
90 (
const U&,
const TaylorVariable<U>& );
91 template <
typename U>
friend TaylorVariable<U>
operator*
92 (
const TaylorVariable<U>&,
const U& );
93 template <
typename U>
friend TaylorVariable<U>
operator/
94 (
const TaylorVariable<U>&,
const TaylorVariable<U>& );
95 template <
typename U>
friend TaylorVariable<U>
operator/
96 (
const double,
const TaylorVariable<U>& );
97 template <
typename U>
friend TaylorVariable<U>
operator/
98 (
const TaylorVariable<U>&,
const double );
99 template <
typename U>
friend std::ostream&
operator<<
100 ( std::ostream&,
const TaylorVariable<U>& );
102 template <
typename U>
friend TaylorVariable<U>
inv 103 (
const TaylorVariable<U>& );
104 template <
typename U>
friend TaylorVariable<U>
sqr 105 (
const TaylorVariable<U>& );
106 template <
typename U>
friend TaylorVariable<U>
sqrt 107 (
const TaylorVariable<U>& );
108 template <
typename U>
friend TaylorVariable<U>
exp 109 (
const TaylorVariable<U>& );
110 template <
typename U>
friend TaylorVariable<U>
log 111 (
const TaylorVariable<U>& );
112 template <
typename U>
friend TaylorVariable<U>
xlog 113 (
const TaylorVariable<U>& );
114 template <
typename U>
friend TaylorVariable<U>
pow 115 (
const TaylorVariable<U>&,
const int );
116 template <
typename U>
friend TaylorVariable<U>
pow 117 (
const TaylorVariable<U>&,
const double );
118 template <
typename U>
friend TaylorVariable<U>
pow 119 (
const double,
const TaylorVariable<U>& );
120 template <
typename U>
friend TaylorVariable<U>
pow 121 (
const TaylorVariable<U>&,
const TaylorVariable<U>& );
122 template <
typename U>
friend TaylorVariable<U>
cos 123 (
const TaylorVariable<U>& );
124 template <
typename U>
friend TaylorVariable<U>
sin 125 (
const TaylorVariable<U>& );
126 template <
typename U>
friend TaylorVariable<U>
tan 127 (
const TaylorVariable<U>& );
128 template <
typename U>
friend TaylorVariable<U>
acos 129 (
const TaylorVariable<U>& );
130 template <
typename U>
friend TaylorVariable<U>
asin 131 (
const TaylorVariable<U>& );
132 template <
typename U>
friend TaylorVariable<U>
atan 133 (
const TaylorVariable<U>& );
134 template <
typename U>
friend TaylorVariable<U>
hull 135 (
const TaylorVariable<U>&,
const TaylorVariable<U>& );
136 template <
typename U>
friend bool inter 137 ( TaylorVariable<U>&,
const TaylorVariable<U>&,
const TaylorVariable<U>& );
144 {
return _TM->
_TV; };
147 {
return _TM->
_nord; };
150 {
return _TM->
_nvar; };
153 {
return _TM->
_nmon; };
156 (
const unsigned int i )
const 160 (
const unsigned int i )
const 164 (
const unsigned int i,
const unsigned int j )
const 168 (
const unsigned int i )
const 172 (
const unsigned int i )
const 176 (
const unsigned int i )
const 185 (
const double d=0. );
200 (
TaylorModel<T>*&TM,
const TaylorVariable<U>&TV,
const T& (U::*method)()
const );
203 (
TaylorModel<T>*&TM,
const TaylorVariable<U>&TV,
T (*method)(
const U& ) );
220 {
T bndmod;
return _bound( bndmod ); }
224 {
T bndmod;
return _bound( bndmod ); }
256 (
const double*x )
const;
264 (
const double*x )
const 278 (
const int opt=0 )
const;
289 (
const TaylorVariable<U>& );
295 (
const TaylorVariable<U>& );
366 (
const unsigned int n,
double*a );
379 #endif // ACADO_TOOLKIT_TAYLOR_VARIABLE_HPP void _init()
Initialize private members.
friend TaylorVariable< U > sqr(const TaylorVariable< U > &)
unsigned int _prodmon(const unsigned int i, const unsigned int j) const
Get exponents of monomial term products in TaylorModel.
USING_NAMESPACE_ACADO typedef TaylorVariable< Interval > T
double * quadratic(const int opt=0) const
Return pointer to array of size nvar comprising coefficients in quadratic term (diagonal coefs if opt...
C++ template class for definition of and operation on variables in a Taylor model.
TaylorVariable< T > & center()
Return reference to current remainder.
friend TaylorVariable< U > sqrt(const TaylorVariable< U > &)
T & _bound_LSB(T &bndmod) const
Range bounder - Lin & Stadtherr approach.
friend TaylorVariable< U > cos(const TaylorVariable< U > &)
friend TaylorVariable< U > sin(const TaylorVariable< U > &)
const T & _bndmon(const unsigned int i) const
Get bounds on all monomial terms in TaylorModel.
double * _refpoint
Reference point.
double * _coefmon
Coefficients for monomial terms 1,...,nmon.
unsigned int * _posord
Positions of terms of degrees 1,...,_nord.
friend TaylorVariable< U > exp(const TaylorVariable< U > &)
TaylorModel< T > * env() const
Return pointer to TaylorModel environment.
T _bndT
Interval bound evaluated in T arithmetic.
double constant() const
Return coefficient value in constant term.
double * _scaling
Variable scaling.
unsigned int _expmon(const unsigned int i) const
Get monomial term exponents in TaylorModel.
void _center_TM()
Center remainder error term _bndrem.
T & _bound_naive(T &bndmod) const
Range bounder - naive approach.
TaylorVariable< T > P() const
Cancel remainder error term and return polynomial part.
T * _bndmon
Bounds on all the monomial terms 1,...,_nmon for given interval vector .
#define CLOSE_NAMESPACE_ACADO
void _update_bndord()
Update _bndord w/ (naive) bounds for individual terms of degrees 0,...,_nord()
unsigned int _nord
Model order of the model.
BooleanType isCompact() const
void _reinit()
Reinitialize private members.
friend TaylorVariable< U > acos(const TaylorVariable< U > &)
friend TaylorVariable< U > asin(const TaylorVariable< U > &)
~TaylorVariable()
Class destructor.
unsigned int _nord() const
Get model order in TaylorModel.
unsigned int _nmon
Number of monomial terms.
void _clean()
Clean private members.
TaylorVariable< T > polynomial() const
Cancel remainder term and return polynomial part.
unsigned int * _expmon
Variable exponents for monomial terms 1,...,_nmon.
T B() const
Return range bounder.
friend TaylorVariable< U > atan(const TaylorVariable< U > &)
friend bool inter(TaylorVariable< U > &, const TaylorVariable< U > &, const TaylorVariable< U > &)
double * reference() const
Return pointer to array of size nvar comprising reference point.
friend TaylorVariable< U > inv(const TaylorVariable< U > &)
friend TaylorVariable< U > log(const TaylorVariable< U > &)
T & _bound_eigen(T &bndmod) const
Range bounder - eignevalue decomposition-based approach.
double * linear() const
Return pointer to array of size nvar comprising coefficients in linear term.
friend TaylorVariable< U > xlog(const TaylorVariable< U > &)
unsigned int _nvar
Number of independent variables.
T * _bndrem
Pointer to the remainder error bound.
TaylorVariable< T > * _TV
Taylor variable to speed-up computations and reduce dynamic allocation.
double _refpoint(const unsigned int i) const
Get reference point in TaylorModel.
T & _bound(T &bndmod) const
Range bounder.
const T & boundT() const
Return reference to range bounder in T arithmetic.
friend TaylorVariable< U > pow(const TaylorVariable< U > &, const int)
TaylorVariable< T > * _TV() const
Get pointer to internal TaylorVariable in TaylorModel.
T * _bndord
Bounds for individual terms of degrees 0,...,_nord+1.
unsigned int _nvar() const
Get number of variables in TaylorModel.
#define BEGIN_NAMESPACE_ACADO
unsigned int _nmon() const
Get number of monomial terms in TaylorModel.
TaylorVariable< T > & C()
Recenter remainder term.
double _scaling(const unsigned int i) const
Get scaling in TaylorModel.
friend TaylorVariable< U > hull(const TaylorVariable< U > &, const TaylorVariable< U > &)
T R() const
Return const reference to current remainder.
friend TaylorVariable< U > tan(const TaylorVariable< U > &)
static double * _eigen(const unsigned int n, double *a)
Wrapper to LAPACK function _dsyev doing eigenvalue decomposition of a symmetric matrix.
friend class TaylorVariable
T bound() const
Return range bounder.
TaylorModel< T > * _TM
Pointer to underlying TaylorModel object.
unsigned int _posord(const unsigned int i) const
Get term positions in TaylorModel.
T remainder() const
Return const reference to current remainder.
unsigned int ** _prodmon
Variable exponents resulting from the product of two monomial terms 1,...,_nmon.
void _size(const unsigned int nvar, const unsigned int nord)
Set the order (nord) and number of variables (nvar)
TaylorVariable< T > _intpow(const TaylorVariable< T > &TM, const int n)
Recursive calculation of nonnegative integer powers.
C++ class supporting the definition and computation of Taylor models for factorable functions...