30 #ifndef SACADO_TAY_TAYLOR_HPP
31 #define SACADO_TAY_TAYLOR_HPP
106 void resize(
int d,
bool keep_coeffs);
131 for (
int i=0; i<=this->
degree(); i++)
132 eq = eq && IE::eval(x.
coeff(i), this->
coeff(i));
162 const T&
val()
const {
return th->coeff_[0];}
188 T tmp= i<=
th->deg_ ?
th->coeff_[i]:
T(0.);
return tmp;}
287 template <
typename T>
298 for (
int i=1; i<=
n; ++i)
300 for (
int i=
n; i<=d; ++i) {
302 c = (c / (i-
n+1)) * (i+1);
308 template <
typename T> Taylor<T>
operator+(
const Base< Taylor<T> >&
a,
309 const Base< Taylor<T> >& b);
310 template <
typename T> Taylor<T>
operator+(
const typename Taylor<T>::value_type&
a,
311 const Base< Taylor<T> >& b);
312 template <
typename T> Taylor<T>
operator+(
const Base< Taylor<T> >&
a,
313 const typename Taylor<T>::value_type& b);
314 template <
typename T> Taylor<T>
operator-(
const Base< Taylor<T> >&
a,
315 const Base< Taylor<T> >& b);
316 template <
typename T> Taylor<T>
operator-(
const typename Taylor<T>::value_type&
a,
317 const Base< Taylor<T> >& b);
318 template <
typename T> Taylor<T>
operator-(
const Base< Taylor<T> >&
a,
319 const typename Taylor<T>::value_type& b);
320 template <
typename T> Taylor<T>
operator*(
const Base< Taylor<T> >&
a,
321 const Base< Taylor<T> >& b);
322 template <
typename T> Taylor<T>
operator*(
const typename Taylor<T>::value_type&
a,
323 const Base< Taylor<T> >& b);
324 template <
typename T> Taylor<T>
operator*(
const Base< Taylor<T> >&
a,
325 const typename Taylor<T>::value_type& b);
326 template <
typename T> Taylor<T>
operator/(
const Base< Taylor<T> >&
a,
327 const Base< Taylor<T> >& b);
328 template <
typename T> Taylor<T>
operator/(
const typename Taylor<T>::value_type&
a,
329 const Base< Taylor<T> >& b);
330 template <
typename T> Taylor<T>
operator/(
const Base< Taylor<T> >&
a,
331 const typename Taylor<T>::value_type& b);
332 template <
typename T> Taylor<T>
exp(
const Base< Taylor<T> >&
a);
333 template <
typename T> Taylor<T>
log(
const Base< Taylor<T> >&
a);
334 template <
typename T> Taylor<T>
log10(
const Base< Taylor<T> >&
a);
335 template <
typename T> Taylor<T>
sqrt(
const Base< Taylor<T> >&
a);
336 #ifdef HAVE_SACADO_CXX11
337 template <
typename T> Taylor<T>
cbrt(
const Base< Taylor<T> >&
a);
339 template <
typename T> Taylor<T>
pow(
const Base< Taylor<T> >&
a,
340 const Base< Taylor<T> >& b);
341 template <
typename T> Taylor<T>
pow(
const typename Taylor<T>::value_type&
a,
342 const Base< Taylor<T> >& b);
343 template <
typename T> Taylor<T>
pow(
const Base< Taylor<T> >&
a,
344 const typename Taylor<T>::value_type& b);
345 template <
typename T>
void sincos(
const Base< Taylor<T> >&
a,
346 Taylor<T>& s, Taylor<T>&
c);
347 template <
typename T> Taylor<T>
cos(
const Base< Taylor<T> >&
a);
348 template <
typename T> Taylor<T>
sin(
const Base< Taylor<T> >&
a);
349 template <
typename T> Taylor<T>
tan(
const Base< Taylor<T> >&
a);
350 template <
typename T>
void sinhcosh(
const Base< Taylor<T> >&
a,
351 Taylor<T>& s, Taylor<T>&
c);
352 template <
typename T> Taylor<T>
cosh(
const Base< Taylor<T> >&
a);
353 template <
typename T> Taylor<T>
sinh(
const Base< Taylor<T> >&
a);
354 template <
typename T> Taylor<T>
tanh(
const Base< Taylor<T> >&
a);
355 template <
typename T> Taylor<T>
quad(
const typename Taylor<T>::value_type& c0,
356 const Base< Taylor<T> >&
a,
357 const Base< Taylor<T> >& b);
358 template <
typename T> Taylor<T>
acos(
const Base< Taylor<T> >&
a);
359 template <
typename T> Taylor<T>
asin(
const Base< Taylor<T> >&
a);
360 template <
typename T> Taylor<T>
atan(
const Base< Taylor<T> >&
a);
361 template <
typename T> Taylor<T>
atan2(
const Base< Taylor<T> >&
a,
362 const Base< Taylor<T> >& b);
363 template <
typename T> Taylor<T>
atan2(
const typename Taylor<T>::value_type&
a,
364 const Base< Taylor<T> >& b);
365 template <
typename T> Taylor<T>
atan2(
const Base< Taylor<T> >&
a,
366 const typename Taylor<T>::value_type& b);
367 template <
typename T> Taylor<T>
acosh(
const Base< Taylor<T> >&
a);
368 template <
typename T> Taylor<T>
asinh(
const Base< Taylor<T> >&
a);
369 template <
typename T> Taylor<T>
atanh(
const Base< Taylor<T> >&
a);
370 template <
typename T> Taylor<T>
abs(
const Base< Taylor<T> >&
a);
371 template <
typename T> Taylor<T>
fabs(
const Base< Taylor<T> >&
a);
372 template <
typename T> Taylor<T>
max(
const Base< Taylor<T> >&
a,
373 const Base< Taylor<T> >& b);
374 template <
typename T> Taylor<T>
max(
const typename Taylor<T>::value_type&
a,
375 const Base< Taylor<T> >& b);
376 template <
typename T> Taylor<T>
max(
const Base< Taylor<T> >&
a,
377 const typename Taylor<T>::value_type& b);
378 template <
typename T> Taylor<T>
min(
const Base< Taylor<T> >&
a,
379 const Base< Taylor<T> >& b);
380 template <
typename T> Taylor<T>
min(
const typename Taylor<T>::value_type&
a,
381 const Base< Taylor<T> >& b);
382 template <
typename T> Taylor<T>
min(
const Base< Taylor<T> >&
a,
383 const typename Taylor<T>::value_type& b);
385 const Base< Taylor<T> >& b);
386 template <
typename T>
bool operator==(
const typename Taylor<T>::value_type&
a,
387 const Base< Taylor<T> >& b);
389 const typename Taylor<T>::value_type& b);
391 const Base< Taylor<T> >& b);
392 template <
typename T>
bool operator!=(
const typename Taylor<T>::value_type&
a,
393 const Base< Taylor<T> >& b);
395 const typename Taylor<T>::value_type& b);
396 template <
typename T>
bool operator<=(const Base< Taylor<T> >&
a,
398 template <
typename T>
bool operator<=(const typename Taylor<T>::value_type&
a,
400 template <
typename T>
bool operator<=(const Base< Taylor<T> >&
a,
401 const typename Taylor<T>::value_type& b);
403 const Base< Taylor<T> >& b);
404 template <
typename T>
bool operator>=(
const typename Taylor<T>::value_type&
a,
405 const Base< Taylor<T> >& b);
407 const typename Taylor<T>::value_type& b);
408 template <
typename T>
bool operator<(const Base< Taylor<T> >&
a,
410 template <
typename T>
bool operator<(const typename Taylor<T>::value_type&
a,
412 template <
typename T>
bool operator<(const Base< Taylor<T> >&
a,
413 const typename Taylor<T>::value_type& b);
415 const Base< Taylor<T> >& b);
416 template <
typename T>
bool operator>(
const typename Taylor<T>::value_type&
a,
417 const Base< Taylor<T> >& b);
419 const typename Taylor<T>::value_type& b);
420 template <
typename T> std::ostream&
operator << (std::ostream& os,
421 const Base< Taylor<T> >&
a);
430 #endif // SACADO_TAY_TAYLOR_HPP
Taylor< T > operator+(const Base< Taylor< T > > &a, const Base< Taylor< T > > &b)
ASinExprType< T >::expr_type asin(const Expr< T > &expr)
void resizeCoeffs(int len)
Resize coefficient array to new size.
void resize(int d, bool keep_coeffs)
Resize polynomial to degree d.
void sinhcosh(const Base< Taylor< T > > &a, Taylor< T > &s, Taylor< T > &c)
T value_type
Typename of values.
int deg_
Degree of polynomial.
Taylor< T > log(const Base< Taylor< T > > &a)
bool hasFastAccess(int d) const
Returns true if polynomial has degree >= d.
Taylor< T > & operator-=(const T &x)
Subtraction-assignment operator with constant right-hand-side.
Taylor< T > asinh(const Base< Taylor< T > > &a)
TanhExprType< T >::expr_type tanh(const Expr< T > &expr)
PowExprType< Expr< T1 >, Expr< T2 > >::expr_type pow(const Expr< T1 > &expr1, const Expr< T2 > &expr2)
TanExprType< T >::expr_type tan(const Expr< T > &expr)
T coeff(int i) const
Returns degree i term with bounds checking.
bool operator>(const Base< Taylor< T > > &a, const Base< Taylor< T > > &b)
Taylor< T > operator+() const
Unary-plus operator.
int len_
Length of allocated polynomial array.
TaylorData & operator=(const TaylorData &x)
Assignment operator.
Taylor< T > & operator*=(const T &x)
Multiplication-assignment operator with constant right-hand-side.
Taylor< T > operator/(const Base< Taylor< T > > &a, const Base< Taylor< T > > &b)
Taylor< T > & operator=(const T &val)
Assignment operator with constant right-hand-side.
ACosExprType< T >::expr_type acos(const Expr< T > &expr)
TaylorData()
Default constructor.
bool operator>=(const Base< Taylor< T > > &a, const Base< Taylor< T > > &b)
Turn Taylor into a meta-function class usable with mpl::apply.
Base class for Sacado types to control overload resolution.
Taylor< T > sin(const Base< Taylor< T > > &a)
void copyForWrite()
Prepare polynomial for writing.
const T & fastAccessCoeff(int i) const
Returns degree i term without bounds checking.
CacheTaylor< T > diff(const CacheTaylor< T > &x, int n=1)
Compute Taylor series of n-th derivative of x.
expr expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c *expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 expr1 expr1 c
Taylor< T > cos(const Base< Taylor< T > > &a)
T & fastAccessCoeff(int i)
Returns degree i term without bounds checking.
Taylor< T > operator-() const
Unary-minus operator.
Taylor< T > quad(const typename Taylor< T >::value_type &c0, const Base< Taylor< T > > &a, const Base< Taylor< T > > &b)
Base template specification for testing equivalence.
bool isEqualTo(const Taylor &x) const
Returns whether two Taylor objects have the same values.
Taylor< T > operator*(const Base< Taylor< T > > &a, const Base< Taylor< T > > &b)
Taylor< T > sinh(const Base< Taylor< T > > &a)
Taylor< T > sqrt(const Base< Taylor< T > > &a)
int length() const
Return length of array.
Log10ExprType< T >::expr_type log10(const Expr< T > &expr)
Taylor< T > max(const Base< Taylor< T > > &a, const Base< Taylor< T > > &b)
Taylor< T > fabs(const Base< Taylor< T > > &a)
const T & val() const
Returns value.
const T * coeff() const
Returns Taylor coefficient array.
Sacado::Handle< TaylorData > th
ATanExprType< T >::expr_type atan(const Expr< T > &expr)
Taylor< T > abs(const Base< Taylor< T > > &a)
void reserve(int d)
Reserve space for a degree d polynomial.
std::ostream & operator<<(std::ostream &os, const Expr< ExprT > &x)
Taylor< T > atan2(const Base< Taylor< T > > &a, const Base< Taylor< T > > &b)
Taylor< T > exp(const Base< Taylor< T > > &a)
T * coeff_
Taylor polynomial coefficients.
ScalarType< value_type >::type scalar_type
Typename of scalar's (which may be different from value_type)
void sincos(const Base< Taylor< T > > &a, Taylor< T > &s, Taylor< T > &c)
Taylor< T > atanh(const Base< Taylor< T > > &a)
Taylor< T > cosh(const Base< Taylor< T > > &a)
bool operator==(const Base< Taylor< T > > &a, const Base< Taylor< T > > &b)
Taylor< T > min(const Base< Taylor< T > > &a, const Base< Taylor< T > > &b)
Taylor< T > operator-(const Base< Taylor< T > > &a, const Base< Taylor< T > > &b)
Taylor< T > & operator/=(const T &x)
Division-assignment operator with constant right-hand-side.
Taylor< T > acosh(const Base< Taylor< T > > &a)
Taylor< T > & operator+=(const T &x)
Addition-assignment operator with constant right-hand-side.
int degree() const
Returns degree of polynomial.
bool operator!=(const Base< Taylor< T > > &a, const Base< Taylor< T > > &b)
Taylor()
Default constructor.
T * coeff()
Returns Taylor coefficient array.