10 #include "Sacado_DynamicArrayTraits.hpp"
17 template <
typename T,
typename Storage>
24 expansion_ = const_expansion_;
27 template <
typename T,
typename Storage>
34 expansion_ = const_expansion_;
37 template <
typename T,
typename Storage>
40 expansion_(expansion),
46 template <
typename T,
typename Storage>
50 expansion_(expansion),
56 template <
typename T,
typename Storage>
59 expansion_(x.expansion_),
65 template <
typename T,
typename Storage>
71 template <
typename T,
typename Storage>
76 expansion_ = expansion;
77 th->
reset(expansion_->getBasis());
80 template <
typename T,
typename Storage>
85 expansion_ = expansion;
86 th->
reset(expansion_->getBasis(), sz);
89 template <
typename T,
typename Storage>
94 return th->evaluate(point);
97 template <
typename T,
typename Storage>
104 return th->evaluate(point, bvals);
107 template <
typename T,
typename Storage>
111 typedef IsEqual<value_type> IE;
112 if (x.size() != this->size())
return false;
115 if (expansion_ != x.expansion_) {
118 if ((expansion_ != const_expansion_) &&
119 (x.expansion_ != x.const_expansion_))
123 for (
int i=0; i<this->size(); i++)
124 eq = eq && IE::eval(x.coeff(i), this->coeff(i));
128 template <
typename T,
typename Storage>
138 template <
typename T,
typename Storage>
143 expansion_ = x.expansion_;
148 template <
typename T,
typename Storage>
156 template <
typename T,
typename Storage>
162 expansion_->unaryMinus(*(x.th), *th);
166 template <
typename T,
typename Storage>
172 expansion_->plusEqual(*th, v);
176 template <
typename T,
typename Storage>
182 expansion_->minusEqual(*th, v);
186 template <
typename T,
typename Storage>
192 expansion_->timesEqual(*th, v);
196 template <
typename T,
typename Storage>
202 expansion_->divideEqual(*th, v);
206 template <
typename T,
typename Storage>
213 if (x.size() > size()) {
217 e->plusEqual(*th, *x.th);
221 template <
typename T,
typename Storage>
228 if (x.size() > size()) {
232 e->minusEqual(*th, *x.th);
236 template <
typename T,
typename Storage>
243 if (x.size() > size()) {
247 e->timesEqual(*th, *x.th);
251 template <
typename T,
typename Storage>
258 if (x.size() > size()) {
262 e->divideEqual(*th, *x.th);
266 template <
typename T,
typename Storage>
273 ordinal_type da = a.size();
274 ordinal_type db = b.size();
276 if (da == db || da > 1)
282 e->plus(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(),
283 b.getOrthogPolyApprox());
288 template <
typename T,
typename Storage>
289 OrthogPoly<T,Storage>
294 b.expansion()->plus(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
298 template <
typename T,
typename Storage>
299 OrthogPoly<T,Storage>
304 a.expansion()->plus(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
308 template <
typename T,
typename Storage>
309 OrthogPoly<T,Storage>
315 ordinal_type da = a.size();
316 ordinal_type db = b.size();
318 if (da == db || da > 1)
324 e->minus(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(),
325 b.getOrthogPolyApprox());
330 template <
typename T,
typename Storage>
331 OrthogPoly<T,Storage>
336 b.expansion()->minus(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
340 template <
typename T,
typename Storage>
341 OrthogPoly<T,Storage>
346 a.expansion()->minus(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
350 template <
typename T,
typename Storage>
351 OrthogPoly<T,Storage>
357 ordinal_type da = a.size();
358 ordinal_type db = b.size();
360 if (da == db || da > 1)
366 e->times(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(),
367 b.getOrthogPolyApprox());
372 template <
typename T,
typename Storage>
373 OrthogPoly<T,Storage>
378 b.expansion()->times(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
382 template <
typename T,
typename Storage>
383 OrthogPoly<T,Storage>
388 a.expansion()->times(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
392 template <
typename T,
typename Storage>
393 OrthogPoly<T,Storage>
399 ordinal_type da = a.size();
400 ordinal_type db = b.size();
402 if (da == db || da > 1)
408 e->divide(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(),
409 b.getOrthogPolyApprox());
414 template <
typename T,
typename Storage>
415 OrthogPoly<T,Storage>
420 b.expansion()->divide(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
424 template <
typename T,
typename Storage>
425 OrthogPoly<T,Storage>
430 a.expansion()->divide(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
434 template <
typename T,
typename Storage>
435 OrthogPoly<T,Storage>
439 a.expansion()->exp(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
443 template <
typename T,
typename Storage>
444 OrthogPoly<T,Storage>
451 a.expansion()->log(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
458 template <
typename T,
typename Storage>
463 a.expansion()->log(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
466 template <
typename T,
typename Storage>
467 OrthogPoly<T,Storage>
471 a.expansion()->log10(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
475 template <
typename T,
typename Storage>
476 OrthogPoly<T,Storage>
480 a.expansion()->sqrt(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
484 template <
typename T,
typename Storage>
485 OrthogPoly<T,Storage>
489 a.expansion()->cbrt(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
493 template <
typename T,
typename Storage>
494 OrthogPoly<T,Storage>
500 ordinal_type da = a.size();
501 ordinal_type db = b.size();
503 if (da == db || da > 1)
509 e->pow(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(),
510 b.getOrthogPolyApprox());
515 template <
typename T,
typename Storage>
516 OrthogPoly<T,Storage>
521 b.expansion()->pow(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
525 template <
typename T,
typename Storage>
526 OrthogPoly<T,Storage>
531 a.expansion()->pow(c.getOrthogPolyApprox(),a.getOrthogPolyApprox(), b);
535 template <
typename T,
typename Storage>
536 OrthogPoly<T,Storage>
540 a.expansion()->sin(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
544 template <
typename T,
typename Storage>
545 OrthogPoly<T,Storage>
549 a.expansion()->cos(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
553 template <
typename T,
typename Storage>
554 OrthogPoly<T,Storage>
558 a.expansion()->tan(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
562 template <
typename T,
typename Storage>
563 OrthogPoly<T,Storage>
567 a.expansion()->sinh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
571 template <
typename T,
typename Storage>
572 OrthogPoly<T,Storage>
576 a.expansion()->cosh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
580 template <
typename T,
typename Storage>
581 OrthogPoly<T,Storage>
585 a.expansion()->tanh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
589 template <
typename T,
typename Storage>
590 OrthogPoly<T,Storage>
594 a.expansion()->acos(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
598 template <
typename T,
typename Storage>
599 OrthogPoly<T,Storage>
603 a.expansion()->asin(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
607 template <
typename T,
typename Storage>
608 OrthogPoly<T,Storage>
612 a.expansion()->atan(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
616 template <
typename T,
typename Storage>
617 OrthogPoly<T,Storage>
621 a.expansion()->acosh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
625 template <
typename T,
typename Storage>
626 OrthogPoly<T,Storage>
630 a.expansion()->asinh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
634 template <
typename T,
typename Storage>
635 OrthogPoly<T,Storage>
639 a.expansion()->atanh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
643 template <
typename T,
typename Storage>
644 OrthogPoly<T,Storage>
648 a.expansion()->fabs(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
652 template <
typename T,
typename Storage>
653 OrthogPoly<T,Storage>
657 a.expansion()->abs(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
661 template <
typename T,
typename Storage>
662 OrthogPoly<T,Storage>
668 ordinal_type da = a.size();
669 ordinal_type db = b.size();
671 if (da == db || da > 1)
677 e->max(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(),
678 b.getOrthogPolyApprox());
683 template <
typename T,
typename Storage>
684 OrthogPoly<T,Storage>
689 b.expansion()->max(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
693 template <
typename T,
typename Storage>
694 OrthogPoly<T,Storage>
699 a.expansion()->max(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
703 template <
typename T,
typename Storage>
704 OrthogPoly<T,Storage>
710 ordinal_type da = a.size();
711 ordinal_type db = b.size();
713 if (da == db || da > 1)
719 e->min(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(),
720 b.getOrthogPolyApprox());
725 template <
typename T,
typename Storage>
726 OrthogPoly<T,Storage>
731 b.expansion()->min(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
735 template <
typename T,
typename Storage>
736 OrthogPoly<T,Storage>
741 a.expansion()->min(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
745 template <
typename T,
typename Storage>
751 for (
int i=0; i<n; i++)
752 if (a.coeff(i) != b.coeff(i))
757 template <
typename T,
typename Storage>
764 for (
int i=1; i<b.size(); i++)
765 if (b.coeff(i) != T(0.0))
770 template <
typename T,
typename Storage>
777 for (
int i=1; i<a.size(); i++)
778 if (a.coeff(i) != T(0.0))
783 template <
typename T,
typename Storage>
791 template <
typename T,
typename Storage>
799 template <
typename T,
typename Storage>
807 template <
typename T,
typename Storage>
809 operator<=(const OrthogPoly<T,Storage>& a,
812 return a.two_norm() <= b.two_norm();
815 template <
typename T,
typename Storage>
820 return a <= b.two_norm();
823 template <
typename T,
typename Storage>
825 operator<=(const OrthogPoly<T,Storage>& a,
828 return a.two_norm() <= b;
831 template <
typename T,
typename Storage>
836 return a.two_norm() >= b.two_norm();
839 template <
typename T,
typename Storage>
844 return a >= b.two_norm();
847 template <
typename T,
typename Storage>
852 return a.two_norm() >= b;
855 template <
typename T,
typename Storage>
857 operator<(const OrthogPoly<T,Storage>& a,
860 return a.two_norm() < b.two_norm();
863 template <
typename T,
typename Storage>
868 return a < b.two_norm();
871 template <
typename T,
typename Storage>
873 operator<(const OrthogPoly<T,Storage>& a,
876 return a.two_norm() < b;
879 template <
typename T,
typename Storage>
884 return a.two_norm() > b.two_norm();
887 template <
typename T,
typename Storage>
892 return a > b.two_norm();
895 template <
typename T,
typename Storage>
900 return a.two_norm() > b;
903 template <
typename T,
typename Storage>
906 for (
int i=0; i<x.size(); i++)
907 is_zero = is_zero && (x.coeff(i) == 0.0);
911 template <
typename T,
typename Storage>
918 template <
typename T,
typename Storage>
926 template <
typename T,
typename Storage>
934 template <
typename T,
typename Storage>
941 template <
typename T,
typename Storage>
949 template <
typename T,
typename Storage>
957 template <
typename T,
typename Storage>
959 operator << (std::ostream& os, const OrthogPoly<T,Storage>& a)
965 for (ordinal_type i=0; i<a.size(); i++) {
966 os << a.coeff(i) <<
" ";
973 template <
typename T,
typename Storage>
983 for (ordinal_type i=0; i<a.size(); i++) {
984 is >> a.fastAccessCoeff(i);
OrthogPoly< T, Storage > exp(const OrthogPoly< T, Storage > &a)
bool operator||(const OrthogPoly< T, Storage > &x1, const OrthogPoly< T, Storage > &x2)
OrthogPoly< T, Storage > log(const OrthogPoly< T, Storage > &a)
#define TEUCHOS_FUNC_TIME_MONITOR(FUNCNAME)
OrthogPoly< T, Storage > sin(const OrthogPoly< T, Storage > &a)
OrthogPoly< T, Storage > sqrt(const OrthogPoly< T, Storage > &a)
bool operator>=(const OrthogPoly< T, Storage > &a, const OrthogPoly< T, Storage > &b)
OrthogPoly< T, Storage > operator-(const OrthogPoly< T, Storage > &a, const OrthogPoly< T, Storage > &b)
bool operator&&(const OrthogPoly< T, Storage > &x1, const OrthogPoly< T, Storage > &x2)
OrthogPoly< T, Storage > pow(const OrthogPoly< T, Storage > &a, const OrthogPoly< T, Storage > &b)
OrthogPoly< T, Storage > atan(const OrthogPoly< T, Storage > &a)
OrthogPoly< T, Storage > cbrt(const OrthogPoly< T, Storage > &a)
OrthogPoly< T, Storage > acos(const OrthogPoly< T, Storage > &a)
OrthogPoly< T, Storage > atanh(const OrthogPoly< T, Storage > &a)
OrthogPoly< T, Storage > cosh(const OrthogPoly< T, Storage > &a)
std::istream & operator>>(std::istream &is, OrthogPoly< T, Storage > &a)
OrthogPoly< T, Storage > sinh(const OrthogPoly< T, Storage > &a)
OrthogPoly< T, Storage > tan(const OrthogPoly< T, Storage > &a)
OrthogPoly< T, Storage > asin(const OrthogPoly< T, Storage > &a)
OrthogPoly< T, Storage > operator+(const OrthogPoly< T, Storage > &a, const OrthogPoly< T, Storage > &b)
OrthogPoly< T, Storage > operator/(const OrthogPoly< T, Storage > &a, const OrthogPoly< T, Storage > &b)
OrthogPoly< T, Storage > max(const OrthogPoly< T, Storage > &a, const OrthogPoly< T, Storage > &b)
bool operator!=(const OrthogPoly< T, Storage > &a, const OrthogPoly< T, Storage > &b)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
OrthogPoly< T, Storage > cos(const OrthogPoly< T, Storage > &a)
bool operator==(const OrthogPoly< T, Storage > &a, const OrthogPoly< T, Storage > &b)
OrthogPoly< T, Storage > acosh(const OrthogPoly< T, Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > max(const typename PCE< Storage >::value_type &a, const PCE< Storage > &b)
OrthogPoly< T, Storage > min(const OrthogPoly< T, Storage > &a, const OrthogPoly< T, Storage > &b)
Orthogonal polynomial expansion class for constant (size 1) expansions.
OrthogPoly< T, Storage > log10(const OrthogPoly< T, Storage > &a)
OrthogPoly< T, Storage > abs(const OrthogPoly< T, Storage > &a)
OrthogPoly< T, Storage > fabs(const OrthogPoly< T, Storage > &a)
Class to store coefficients of a projection onto an orthogonal polynomial basis.
OrthogPoly< T, Storage > asinh(const OrthogPoly< T, Storage > &a)
OrthogPoly< T, Storage > tanh(const OrthogPoly< T, Storage > &a)
bool operator>(const OrthogPoly< T, Storage > &a, const OrthogPoly< T, Storage > &b)
OrthogPoly< T, Storage > operator*(const OrthogPoly< T, Storage > &a, const OrthogPoly< T, Storage > &b)
bool toBool(const OrthogPoly< T, Storage > &x)