42 #include "Sacado_DynamicArrayTraits.hpp"
49 template <
typename T,
typename Storage>
52 expansion_(const_expansion_),
57 template <
typename T,
typename Storage>
60 expansion_(const_expansion_),
65 template <
typename T,
typename Storage>
68 expansion_(expansion),
73 template <
typename T,
typename Storage>
77 expansion_(expansion),
82 template <
typename T,
typename Storage>
85 expansion_(x.expansion_),
90 template <
typename T,
typename Storage>
96 template <
typename T,
typename Storage>
101 expansion_ = expansion;
102 th->
reset(expansion_->getBasis());
105 template <
typename T,
typename Storage>
110 expansion_ = expansion;
111 th->
reset(expansion_->getBasis(), sz);
114 template <
typename T,
typename Storage>
119 return th->evaluate(point);
122 template <
typename T,
typename Storage>
129 return th->evaluate(point, bvals);
132 template <
typename T,
typename Storage>
136 typedef IsEqual<value_type> IE;
137 if (x.size() != this->size())
return false;
140 if (expansion_ != x.expansion_) {
143 if ((expansion_ != const_expansion_) &&
144 (x.expansion_ != const_expansion_))
148 for (
int i=0; i<this->size(); i++)
149 eq = eq && IE::eval(x.coeff(i), this->coeff(i));
153 template <
typename T,
typename Storage>
163 template <
typename T,
typename Storage>
168 expansion_ = x.expansion_;
173 template <
typename T,
typename Storage>
181 template <
typename T,
typename Storage>
187 expansion_->unaryMinus(*(x.th), *th);
191 template <
typename T,
typename Storage>
197 expansion_->plusEqual(*th, v);
201 template <
typename T,
typename Storage>
207 expansion_->minusEqual(*th, v);
211 template <
typename T,
typename Storage>
217 expansion_->timesEqual(*th, v);
221 template <
typename T,
typename Storage>
227 expansion_->divideEqual(*th, v);
231 template <
typename T,
typename Storage>
238 if (x.size() > size()) {
242 e->plusEqual(*th, *x.th);
246 template <
typename T,
typename Storage>
253 if (x.size() > size()) {
257 e->minusEqual(*th, *x.th);
261 template <
typename T,
typename Storage>
268 if (x.size() > size()) {
272 e->timesEqual(*th, *x.th);
276 template <
typename T,
typename Storage>
283 if (x.size() > size()) {
287 e->divideEqual(*th, *x.th);
291 template <
typename T,
typename Storage>
298 ordinal_type da = a.size();
299 ordinal_type db = b.size();
301 if (da == db || da > 1)
307 e->plus(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(),
308 b.getOrthogPolyApprox());
313 template <
typename T,
typename Storage>
314 OrthogPoly<T,Storage>
319 b.expansion()->plus(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
323 template <
typename T,
typename Storage>
324 OrthogPoly<T,Storage>
329 a.expansion()->plus(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
333 template <
typename T,
typename Storage>
334 OrthogPoly<T,Storage>
340 ordinal_type da = a.size();
341 ordinal_type db = b.size();
343 if (da == db || da > 1)
349 e->minus(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(),
350 b.getOrthogPolyApprox());
355 template <
typename T,
typename Storage>
356 OrthogPoly<T,Storage>
361 b.expansion()->minus(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
365 template <
typename T,
typename Storage>
366 OrthogPoly<T,Storage>
371 a.expansion()->minus(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
375 template <
typename T,
typename Storage>
376 OrthogPoly<T,Storage>
382 ordinal_type da = a.size();
383 ordinal_type db = b.size();
385 if (da == db || da > 1)
391 e->times(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(),
392 b.getOrthogPolyApprox());
397 template <
typename T,
typename Storage>
398 OrthogPoly<T,Storage>
403 b.expansion()->times(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
407 template <
typename T,
typename Storage>
408 OrthogPoly<T,Storage>
413 a.expansion()->times(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
417 template <
typename T,
typename Storage>
418 OrthogPoly<T,Storage>
424 ordinal_type da = a.size();
425 ordinal_type db = b.size();
427 if (da == db || da > 1)
433 e->divide(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(),
434 b.getOrthogPolyApprox());
439 template <
typename T,
typename Storage>
440 OrthogPoly<T,Storage>
445 b.expansion()->divide(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
449 template <
typename T,
typename Storage>
450 OrthogPoly<T,Storage>
455 a.expansion()->divide(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
459 template <
typename T,
typename Storage>
460 OrthogPoly<T,Storage>
464 a.expansion()->exp(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
468 template <
typename T,
typename Storage>
469 OrthogPoly<T,Storage>
476 a.expansion()->log(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
483 template <
typename T,
typename Storage>
488 a.expansion()->log(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
491 template <
typename T,
typename Storage>
492 OrthogPoly<T,Storage>
496 a.expansion()->log10(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
500 template <
typename T,
typename Storage>
501 OrthogPoly<T,Storage>
505 a.expansion()->sqrt(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
509 template <
typename T,
typename Storage>
510 OrthogPoly<T,Storage>
514 a.expansion()->cbrt(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
518 template <
typename T,
typename Storage>
519 OrthogPoly<T,Storage>
525 ordinal_type da = a.size();
526 ordinal_type db = b.size();
528 if (da == db || da > 1)
534 e->pow(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(),
535 b.getOrthogPolyApprox());
540 template <
typename T,
typename Storage>
541 OrthogPoly<T,Storage>
546 b.expansion()->pow(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
550 template <
typename T,
typename Storage>
551 OrthogPoly<T,Storage>
556 a.expansion()->pow(c.getOrthogPolyApprox(),a.getOrthogPolyApprox(), b);
560 template <
typename T,
typename Storage>
561 OrthogPoly<T,Storage>
565 a.expansion()->sin(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
569 template <
typename T,
typename Storage>
570 OrthogPoly<T,Storage>
574 a.expansion()->cos(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
578 template <
typename T,
typename Storage>
579 OrthogPoly<T,Storage>
583 a.expansion()->tan(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
587 template <
typename T,
typename Storage>
588 OrthogPoly<T,Storage>
592 a.expansion()->sinh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
596 template <
typename T,
typename Storage>
597 OrthogPoly<T,Storage>
601 a.expansion()->cosh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
605 template <
typename T,
typename Storage>
606 OrthogPoly<T,Storage>
610 a.expansion()->tanh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
614 template <
typename T,
typename Storage>
615 OrthogPoly<T,Storage>
619 a.expansion()->acos(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
623 template <
typename T,
typename Storage>
624 OrthogPoly<T,Storage>
628 a.expansion()->asin(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
632 template <
typename T,
typename Storage>
633 OrthogPoly<T,Storage>
637 a.expansion()->atan(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
641 template <
typename T,
typename Storage>
642 OrthogPoly<T,Storage>
646 a.expansion()->acosh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
650 template <
typename T,
typename Storage>
651 OrthogPoly<T,Storage>
655 a.expansion()->asinh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
659 template <
typename T,
typename Storage>
660 OrthogPoly<T,Storage>
664 a.expansion()->atanh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
668 template <
typename T,
typename Storage>
669 OrthogPoly<T,Storage>
673 a.expansion()->fabs(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
677 template <
typename T,
typename Storage>
678 OrthogPoly<T,Storage>
682 a.expansion()->abs(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
686 template <
typename T,
typename Storage>
687 OrthogPoly<T,Storage>
693 ordinal_type da = a.size();
694 ordinal_type db = b.size();
696 if (da == db || da > 1)
702 e->max(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(),
703 b.getOrthogPolyApprox());
708 template <
typename T,
typename Storage>
709 OrthogPoly<T,Storage>
714 b.expansion()->max(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
718 template <
typename T,
typename Storage>
719 OrthogPoly<T,Storage>
724 a.expansion()->max(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
728 template <
typename T,
typename Storage>
729 OrthogPoly<T,Storage>
735 ordinal_type da = a.size();
736 ordinal_type db = b.size();
738 if (da == db || da > 1)
744 e->min(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(),
745 b.getOrthogPolyApprox());
750 template <
typename T,
typename Storage>
751 OrthogPoly<T,Storage>
756 b.expansion()->min(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
760 template <
typename T,
typename Storage>
761 OrthogPoly<T,Storage>
766 a.expansion()->min(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
770 template <
typename T,
typename Storage>
776 for (
int i=0; i<n; i++)
777 if (a.coeff(i) != b.coeff(i))
782 template <
typename T,
typename Storage>
789 for (
int i=1; i<b.size(); i++)
790 if (b.coeff(i) != T(0.0))
795 template <
typename T,
typename Storage>
802 for (
int i=1; i<a.size(); i++)
803 if (a.coeff(i) != T(0.0))
808 template <
typename T,
typename Storage>
816 template <
typename T,
typename Storage>
824 template <
typename T,
typename Storage>
832 template <
typename T,
typename Storage>
834 operator<=(const OrthogPoly<T,Storage>& a,
837 return a.two_norm() <= b.two_norm();
840 template <
typename T,
typename Storage>
845 return a <= b.two_norm();
848 template <
typename T,
typename Storage>
850 operator<=(const OrthogPoly<T,Storage>& a,
853 return a.two_norm() <= b;
856 template <
typename T,
typename Storage>
861 return a.two_norm() >= b.two_norm();
864 template <
typename T,
typename Storage>
869 return a >= b.two_norm();
872 template <
typename T,
typename Storage>
877 return a.two_norm() >= b;
880 template <
typename T,
typename Storage>
882 operator<(const OrthogPoly<T,Storage>& a,
885 return a.two_norm() < b.two_norm();
888 template <
typename T,
typename Storage>
893 return a < b.two_norm();
896 template <
typename T,
typename Storage>
898 operator<(const OrthogPoly<T,Storage>& a,
901 return a.two_norm() < b;
904 template <
typename T,
typename Storage>
909 return a.two_norm() > b.two_norm();
912 template <
typename T,
typename Storage>
917 return a > b.two_norm();
920 template <
typename T,
typename Storage>
925 return a.two_norm() > b;
928 template <
typename T,
typename Storage>
931 for (
int i=0; i<x.size(); i++)
932 is_zero = is_zero && (x.coeff(i) == 0.0);
936 template <
typename T,
typename Storage>
943 template <
typename T,
typename Storage>
951 template <
typename T,
typename Storage>
959 template <
typename T,
typename Storage>
966 template <
typename T,
typename Storage>
974 template <
typename T,
typename Storage>
982 template <
typename T,
typename Storage>
984 operator << (std::ostream& os, const OrthogPoly<T,Storage>& a)
990 for (ordinal_type i=0; i<a.size(); i++) {
991 os << a.coeff(i) <<
" ";
998 template <
typename T,
typename Storage>
1008 for (ordinal_type i=0; i<a.size(); i++) {
1009 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)
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)
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)