1 #ifndef CLASSIC_Taylor_CC
2 #define CLASSIC_Taylor_CC
48 itsCoeffs(rhs.itsCoeffs)
66 template<
class T>
inline
69 return itsCoeffs.begin();
73 template<
class T>
inline
76 return itsCoeffs.begin();
80 template<
class T>
inline
83 return itsCoeffs.end();
87 template<
class T>
inline
90 return itsCoeffs.end();
94 template<
class T>
inline
100 template<
class T>
inline
109 std::transform(begin(), end(), result.
begin(), std::negate<T>());
116 std::transform(begin(), end(), begin(),
117 std::bind2nd(std::multiplies<T>(), val));
124 std::transform(begin(), end(), begin(),
125 std::bind2nd(std::divides<T>(), val));
134 std::copy(begin(), end(), temp.begin());
139 std::transform(begin(), begin() + n, rhs.
begin(), begin(), std::plus<T>());
148 std::copy(begin(), end(), temp.begin());
153 std::transform(begin(), begin() + n, rhs.
begin(), begin(), std::minus<T>());
161 erase(begin(), end());
169 const T *x1 = begin();
174 for(
const T *x = x1; x < x2; ++x, ++z) {
186 return std::accumulate(begin(), end(),
T(0));
190 template <
class T>
inline
193 return itsCoeffs.size() - 1;
207 while(x != lhs.
end() && y != rhs.
end()) {
210 while(x != lhs.
end()) *z++ = *x++;
211 while(y != rhs.
end()) *z++ = *y++;
223 while(x != lhs.
end() && y != rhs.
end()) {
226 while(x != lhs.
end()) *z++ = *x++;
227 while(y != rhs.
end()) *z++ = - *y++;
237 T *z = result.begin();
238 while(x != lhs.
end()) {
250 T *z = result.begin();
251 while(x != rhs.
end()) {
263 T *z = result.begin();
264 while(x != lhs.
end()) {
275 for(
int i = 0; i <= lhs.
getOrder(); ++i) {
276 if(! lhs[i].isZero()) {
277 for(
int j = 0; j <= rhs.
getOrder(); ++j) {
278 if(! rhs[j].isZero()) {
289 std::ostream &operator<<(std::ostream &os, const Taylor<T> &series) {
290 os <<
"Taylor" << std::setw(4) << series.getOrder() <<
std::endl;
292 for(
int i = 0; i <= series.getOrder(); ++i) {
293 os <<
"Terms of order" << std::setw(4) << i <<
" " << series[i];
Matrix< T > operator+(const Matrix< T > &, const Matrix< T > &)
Matrix addition.
Taylor & operator/=(const T &)
Divide by scalar and assign.
T sum() const
Return sum of series.
Matrix< T > operator/(const Matrix< T > &, const T &)
Matrix divided by scalar.
Taylor & operator-=(const Taylor &)
Subtract series and assign.
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
void clear()
Clear all coefficients.
Matrix< T > operator*(const Matrix< T > &, const Matrix< T > &)
Matrix multiply.
Taylor & operator+=(const Taylor &)
Add series and assign.
const Taylor & operator=(const Taylor &)
Tps< T > PoissonBracket(const Tps< T > &x, const Tps< T > &y)
Poisson bracket.
T * begin()
Get pointer to beginning of series (zero-order term).
T * end()
Get pointer to end of series (one beyond highest term).
Taylor integrate() const
Integrate with respect to the variable.
T & operator[](int n)
Get coefficient.
Taylor operator-() const
Change sign of series.
int getOrder() const
Return order of this series.
A representation for a Taylor series in one variable,.
Matrix< T > operator-(const Matrix< T > &, const Matrix< T > &)
Matrix subtraction.
Taylor & operator*=(const T &)
Multiply by scalar and assign.
Inform & endl(Inform &inf)