1 #ifndef CLASSIC_Taylor_CC
2 #define CLASSIC_Taylor_CC
49 itsCoeffs(rhs.itsCoeffs)
67 template<
class T>
inline
70 return itsCoeffs.begin();
74 template<
class T>
inline
77 return itsCoeffs.begin();
81 template<
class T>
inline
84 return itsCoeffs.end();
88 template<
class T>
inline
91 return itsCoeffs.end();
95 template<
class T>
inline
101 template<
class T>
inline
110 std::transform(
begin(),
end(), result.
begin(), std::negate<T>());
118 std::bind(std::multiplies<T>(), std::placeholders::_2, val));
126 std::bind(std::divides<T>(), std::placeholders::_2, val));
175 for(
const T *x = x1; x < x2; ++x, ++z) {
187 return std::accumulate(
begin(),
end(),
T(0));
191 template <
class T>
inline
194 return itsCoeffs.size() - 1;
208 while(x != lhs.
end() && y != rhs.
end()) {
211 while(x != lhs.
end()) *z++ = *x++;
212 while(y != rhs.
end()) *z++ = *y++;
224 while(x != lhs.
end() && y != rhs.
end()) {
227 while(x != lhs.
end()) *z++ = *x++;
228 while(y != rhs.
end()) *z++ = - *y++;
239 while(x != lhs.
end()) {
252 while(x != rhs.
end()) {
265 while(x != lhs.
end()) {
276 for(
int i = 0; i <= lhs.
getOrder(); ++i) {
277 if(! lhs[i].isZero()) {
278 for(
int j = 0; j <= rhs.
getOrder(); ++j) {
279 if(! rhs[j].isZero()) {
293 for(
int i = 0; i <= series.
getOrder(); ++i) {
294 os <<
"Terms of order" << std::setw(4) << i <<
" " << series[i];
PartBunchBase< T, Dim >::ConstIterator end(PartBunchBase< T, Dim > const &bunch)
PartBunchBase< T, Dim >::ConstIterator begin(PartBunchBase< T, Dim > const &bunch)
Taylor< T > PoissonBracket(const Taylor< T > &lhs, const Taylor< T > &rhs)
Poisson bracket of two Taylor seriess.
Taylor< T > operator-(const Taylor< T > &lhs, const Taylor< T > &rhs)
Subtract.
Taylor< T > operator+(const Taylor< T > &lhs, const Taylor< T > &rhs)
Add.
Taylor< T > operator/(const Taylor< T > &lhs, double rhs)
Divide by scalar.
std::ostream & operator<<(std::ostream &os, const Taylor< T > &series)
Output.
Taylor< T > operator*(const Taylor< T > &lhs, double rhs)
Multiply by scalar.
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Inform & endl(Inform &inf)
A representation for a Taylor series in one variable,.
T * end()
Get pointer to end of series (one beyond highest term).
void clear()
Clear all coefficients.
int getOrder() const
Return order of this series.
Taylor operator-() const
Change sign of series.
T * begin()
Get pointer to beginning of series (zero-order term).
Taylor & operator/=(const T &)
Divide by scalar and assign.
T sum() const
Return sum of series.
Taylor & operator-=(const Taylor &)
Subtract series and assign.
T & operator[](int n)
Get coefficient.
Taylor & operator+=(const Taylor &)
Add series and assign.
const Taylor & operator=(const Taylor &)
Taylor integrate() const
Integrate with respect to the variable.
Taylor & operator*=(const T &)
Multiply by scalar and assign.