42 #ifndef SACADO_PCE_ORTHOGPOLY_HPP 43 #define SACADO_PCE_ORTHOGPOLY_HPP 47 #ifdef HAVE_STOKHOS_SACADO 49 #include "Teuchos_RCP.hpp" 51 #include "Sacado_Traits.hpp" 52 #include "Sacado_Handle.hpp" 53 #include "Sacado_mpl_apply.hpp" 73 template <
typename T,
typename Storage >
98 typedef typename approx_type::pointer pointer;
99 typedef typename approx_type::const_pointer const_pointer;
100 typedef typename approx_type::reference reference;
101 typedef typename approx_type::const_reference const_reference;
104 template <
typename S>
106 typedef typename Sacado::mpl::apply<Storage,ordinal_type,S>::type
storage_type;
107 typedef OrthogPoly<S,storage_type> type;
126 OrthogPoly(
const Teuchos::RCP<expansion_type>& expansion);
132 OrthogPoly(
const Teuchos::RCP<expansion_type>& expansion,
136 OrthogPoly(
const OrthogPoly&
x);
142 void init(
const T& v) { th->init(v); }
145 void init(
const T* v) { th->init(v); }
148 template <
typename S>
149 void init(
const OrthogPoly<T,S>& v) { th->init(v.getOrthogPolyApprox()); }
152 void load(T* v) { th->load(v); }
155 template <
typename S>
156 void load(OrthogPoly<T,S>& v) { th->load(v.getOrthogPolyApprox()); }
162 void reset(
const Teuchos::RCP<expansion_type>& expansion);
168 void reset(
const Teuchos::RCP<expansion_type>& expansion,
181 void copyForWrite() { th.makeOwnCopy(); }
184 value_type evaluate(
const Teuchos::Array<value_type>& point)
const;
187 value_type evaluate(
const Teuchos::Array<value_type>& point,
188 const Teuchos::Array<value_type>& bvals)
const;
194 value_type standard_deviation()
const {
return th->standard_deviation(); }
197 value_type two_norm()
const {
return th->two_norm(); }
200 value_type two_norm_squared()
const {
return th->two_norm_squared(); }
203 value_type inner_product(
const OrthogPoly& b)
const {
204 return th->inner_product(b.getOrthogPolyApprox()); }
207 std::ostream& print(std::ostream& os)
const {
return th->print(os); }
210 bool isEqualTo(
const OrthogPoly&
x)
const;
221 OrthogPoly<T,Storage>& operator=(
const OrthogPoly<T,Storage>&
x);
231 Teuchos::RCP<const basis_type> basis()
const {
return th->basis(); }
234 Teuchos::RCP<expansion_type> expansion()
const {
return expansion_; }
244 const_reference
val()
const {
return (*th)[0]; }
247 reference
val() {
return (*th)[0]; }
260 bool hasFastAccess(
ordinal_type sz)
const {
return th->size()>=sz;}
263 const_pointer coeff()
const {
return th->coeff();}
266 pointer coeff() {
return th->coeff();}
280 return th->term(dimension, order); }
284 return th->term(dimension, order); }
287 Teuchos::Array<ordinal_type> order(
ordinal_type term)
const {
288 return th->order(term); }
304 OrthogPoly<T,Storage>& operator += (
const value_type&
x);
307 OrthogPoly<T,Storage>& operator -= (
const value_type&
x);
310 OrthogPoly<T,Storage>& operator *= (
const value_type&
x);
313 OrthogPoly<T,Storage>& operator /= (
const value_type&
x);
316 OrthogPoly<T,Storage>& operator += (
const OrthogPoly<T,Storage>&
x);
319 OrthogPoly<T,Storage>& operator -= (
const OrthogPoly<T,Storage>&
x);
322 OrthogPoly<T,Storage>& operator *= (
const OrthogPoly<T,Storage>&
x);
325 OrthogPoly<T,Storage>& operator /= (
const OrthogPoly<T,Storage>&
x);
330 const approx_type& getOrthogPolyApprox()
const {
return *th; }
333 approx_type& getOrthogPolyApprox() {
return *th; }
338 Teuchos::RCP<expansion_type> expansion_;
341 Teuchos::RCP<expansion_type> const_expansion_;
343 Sacado::Handle< Stokhos::OrthogPolyApprox<int,value_type,Storage> > th;
348 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
349 operator+(
const OrthogPoly<T,Storage>& a,
const OrthogPoly<T,Storage>& b);
351 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
353 const OrthogPoly<T,Storage>& b);
355 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
356 operator+(
const OrthogPoly<T,Storage>& a,
359 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
360 operator-(
const OrthogPoly<T,Storage>& a,
const OrthogPoly<T,Storage>& b);
362 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
364 const OrthogPoly<T,Storage>& b);
366 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
367 operator-(
const OrthogPoly<T,Storage>& a,
370 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
371 operator*(
const OrthogPoly<T,Storage>& a,
const OrthogPoly<T,Storage>& b);
373 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
375 const OrthogPoly<T,Storage>& b);
377 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
378 operator*(
const OrthogPoly<T,Storage>& a,
381 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
382 operator/(
const OrthogPoly<T,Storage>& a,
const OrthogPoly<T,Storage>& b);
384 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
386 const OrthogPoly<T,Storage>& b);
388 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
389 operator/(
const OrthogPoly<T,Storage>& a,
392 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
393 exp(
const OrthogPoly<T,Storage>& a);
395 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
396 log(
const OrthogPoly<T,Storage>& a);
398 template <
typename T,
typename Storage>
void 399 log(OrthogPoly<T,Storage>& c,
const OrthogPoly<T,Storage>& a);
401 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
402 log10(
const OrthogPoly<T,Storage>& a);
404 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
405 sqrt(
const OrthogPoly<T,Storage>& a);
407 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
408 cbrt(
const OrthogPoly<T,Storage>& a);
410 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
411 pow(
const OrthogPoly<T,Storage>& a,
const OrthogPoly<T,Storage>& b);
413 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
415 const OrthogPoly<T,Storage>& b);
417 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
418 pow(
const OrthogPoly<T,Storage>& a,
421 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
422 cos(
const OrthogPoly<T,Storage>& a);
424 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
425 sin(
const OrthogPoly<T,Storage>& a);
427 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
428 tan(
const OrthogPoly<T,Storage>& a);
430 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
431 cosh(
const OrthogPoly<T,Storage>& a);
433 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
434 sinh(
const OrthogPoly<T,Storage>& a);
436 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
437 tanh(
const OrthogPoly<T,Storage>& a);
439 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
440 acos(
const OrthogPoly<T,Storage>& a);
442 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
443 asin(
const OrthogPoly<T,Storage>& a);
445 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
446 atan(
const OrthogPoly<T,Storage>& a);
448 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
449 atan2(
const OrthogPoly<T,Storage>& a,
const OrthogPoly<T,Storage>& b);
451 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
453 const OrthogPoly<T,Storage>& b);
455 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
456 atan2(
const OrthogPoly<T,Storage>& a,
459 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
460 acosh(
const OrthogPoly<T,Storage>& a);
462 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
463 asinh(
const OrthogPoly<T,Storage>& a);
465 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
466 atanh(
const OrthogPoly<T,Storage>& a);
468 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
469 abs(
const OrthogPoly<T,Storage>& a);
471 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
472 fabs(
const OrthogPoly<T,Storage>& a);
474 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
475 max(
const OrthogPoly<T,Storage>& a,
const OrthogPoly<T,Storage>& b);
477 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
479 const OrthogPoly<T,Storage>& b);
481 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
482 max(
const OrthogPoly<T,Storage>& a,
485 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
486 min(
const OrthogPoly<T,Storage>& a,
const OrthogPoly<T,Storage>& b);
488 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
490 const OrthogPoly<T,Storage>& b);
492 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
493 min(
const OrthogPoly<T,Storage>& a,
496 template <
typename T,
typename Storage>
bool 498 const OrthogPoly<T,Storage>& b);
500 template <
typename T,
typename Storage>
bool 502 const OrthogPoly<T,Storage>& b);
504 template <
typename T,
typename Storage>
bool 508 template <
typename T,
typename Storage>
bool 510 const OrthogPoly<T,Storage>& b);
512 template <
typename T,
typename Storage>
bool 514 const OrthogPoly<T,Storage>& b);
516 template <
typename T,
typename Storage>
bool 520 template <
typename T,
typename Storage>
bool 521 operator<=(const OrthogPoly<T,Storage>& a,
522 const OrthogPoly<T,Storage>& b);
524 template <
typename T,
typename Storage>
bool 526 const OrthogPoly<T,Storage>& b);
528 template <
typename T,
typename Storage>
bool 529 operator<=(const OrthogPoly<T,Storage>& a,
532 template <
typename T,
typename Storage>
bool 534 const OrthogPoly<T,Storage>& b);
536 template <
typename T,
typename Storage>
bool 538 const OrthogPoly<T,Storage>& b);
540 template <
typename T,
typename Storage>
bool 544 template <
typename T,
typename Storage>
bool 545 operator<(const OrthogPoly<T,Storage>& a,
546 const OrthogPoly<T,Storage>& b);
548 template <
typename T,
typename Storage>
bool 550 const OrthogPoly<T,Storage>& b);
552 template <
typename T,
typename Storage>
bool 553 operator<(const OrthogPoly<T,Storage>& a,
556 template <
typename T,
typename Storage>
bool 557 operator>(
const OrthogPoly<T,Storage>& a,
558 const OrthogPoly<T,Storage>& b);
560 template <
typename T,
typename Storage>
bool 562 const OrthogPoly<T,Storage>& b);
564 template <
typename T,
typename Storage>
bool 565 operator>(
const OrthogPoly<T,Storage>& a,
568 template <
typename T,
typename Storage> std::ostream&
569 operator << (std::ostream& os, const OrthogPoly<T,Storage>& a);
571 template <
typename T,
typename Storage> std::istream&
572 operator >> (std::istream& os, OrthogPoly<T,Storage>& a);
581 #endif // HAVE_STOKHOS_SACADO 583 #endif // SACADO_PCE_ORTHOGPOLY_HPP
OrthogPoly< T, Storage > exp(const OrthogPoly< T, Storage > &a)
OrthogPoly< T, Storage > log(const OrthogPoly< T, Storage > &a)
Stokhos::StandardStorage< int, double > storage_type
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)
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)
expr1 expr1 expr1 expr2 expr1 expr1 c expr2 expr1 c fastAccessCoeff(j) - expr2.val(j)
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)
atan2(expr1.val(), expr2.val())
Stokhos::LegendreBasis< int, double > basis_type
Abstract base class for orthogonal polynomial-based expansions.
bool operator!=(const OrthogPoly< T, Storage > &a, const OrthogPoly< T, Storage > &b)
Abstract base class for multivariate orthogonal polynomials.
const IndexType const IndexType const IndexType const IndexType const ValueType const ValueType * x
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)
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)