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" 72 template <
typename T,
typename Storage >
97 typedef typename approx_type::pointer pointer;
98 typedef typename approx_type::const_pointer const_pointer;
99 typedef typename approx_type::reference reference;
100 typedef typename approx_type::const_reference const_reference;
103 template <
typename S>
105 typedef typename Sacado::mpl::apply<Storage,ordinal_type,S>::type
storage_type;
106 typedef OrthogPoly<S,storage_type> type;
125 OrthogPoly(
const Teuchos::RCP<expansion_type>& expansion);
131 OrthogPoly(
const Teuchos::RCP<expansion_type>& expansion,
135 OrthogPoly(
const OrthogPoly&
x);
141 void init(
const T& v) { th->init(v); }
144 void init(
const T* v) { th->init(v); }
147 template <
typename S>
148 void init(
const OrthogPoly<T,S>& v) { th->init(v.getOrthogPolyApprox()); }
151 void load(T* v) { th->load(v); }
154 template <
typename S>
155 void load(OrthogPoly<T,S>& v) { th->load(v.getOrthogPolyApprox()); }
161 void reset(
const Teuchos::RCP<expansion_type>& expansion);
167 void reset(
const Teuchos::RCP<expansion_type>& expansion,
180 void copyForWrite() { th.makeOwnCopy(); }
183 value_type evaluate(
const Teuchos::Array<value_type>& point)
const;
186 value_type evaluate(
const Teuchos::Array<value_type>& point,
187 const Teuchos::Array<value_type>& bvals)
const;
193 value_type standard_deviation()
const {
return th->standard_deviation(); }
196 value_type two_norm()
const {
return th->two_norm(); }
199 value_type two_norm_squared()
const {
return th->two_norm_squared(); }
202 value_type inner_product(
const OrthogPoly& b)
const {
203 return th->inner_product(b.getOrthogPolyApprox()); }
206 std::ostream& print(std::ostream& os)
const {
return th->print(os); }
209 bool isEqualTo(
const OrthogPoly&
x)
const;
220 OrthogPoly<T,Storage>& operator=(
const OrthogPoly<T,Storage>&
x);
230 Teuchos::RCP<const basis_type> basis()
const {
return th->basis(); }
233 Teuchos::RCP<expansion_type> expansion()
const {
return expansion_; }
243 const_reference
val()
const {
return (*th)[0]; }
246 reference
val() {
return (*th)[0]; }
259 bool hasFastAccess(
ordinal_type sz)
const {
return th->size()>=sz;}
262 const_pointer coeff()
const {
return th->coeff();}
265 pointer coeff() {
return th->coeff();}
279 return th->term(dimension, order); }
283 return th->term(dimension, order); }
286 Teuchos::Array<ordinal_type> order(
ordinal_type term)
const {
287 return th->order(term); }
303 OrthogPoly<T,Storage>& operator += (
const value_type&
x);
306 OrthogPoly<T,Storage>& operator -= (
const value_type&
x);
309 OrthogPoly<T,Storage>& operator *= (
const value_type&
x);
312 OrthogPoly<T,Storage>& operator /= (
const value_type&
x);
315 OrthogPoly<T,Storage>& operator += (
const OrthogPoly<T,Storage>&
x);
318 OrthogPoly<T,Storage>& operator -= (
const OrthogPoly<T,Storage>&
x);
321 OrthogPoly<T,Storage>& operator *= (
const OrthogPoly<T,Storage>&
x);
324 OrthogPoly<T,Storage>& operator /= (
const OrthogPoly<T,Storage>&
x);
329 const approx_type& getOrthogPolyApprox()
const {
return *th; }
332 approx_type& getOrthogPolyApprox() {
return *th; }
337 Teuchos::RCP<expansion_type> expansion_;
340 static Teuchos::RCP<expansion_type> const_expansion_;
342 Sacado::Handle< Stokhos::OrthogPolyApprox<int,value_type,Storage> > th;
347 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
348 operator+(
const OrthogPoly<T,Storage>& a,
const OrthogPoly<T,Storage>& b);
350 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
352 const OrthogPoly<T,Storage>& b);
354 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
355 operator+(
const OrthogPoly<T,Storage>& a,
358 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
359 operator-(
const OrthogPoly<T,Storage>& a,
const OrthogPoly<T,Storage>& b);
361 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
363 const OrthogPoly<T,Storage>& b);
365 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
366 operator-(
const OrthogPoly<T,Storage>& a,
369 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
370 operator*(
const OrthogPoly<T,Storage>& a,
const OrthogPoly<T,Storage>& b);
372 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
374 const OrthogPoly<T,Storage>& b);
376 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
377 operator*(
const OrthogPoly<T,Storage>& a,
380 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
381 operator/(
const OrthogPoly<T,Storage>& a,
const OrthogPoly<T,Storage>& b);
383 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
385 const OrthogPoly<T,Storage>& b);
387 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
388 operator/(
const OrthogPoly<T,Storage>& a,
391 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
392 exp(
const OrthogPoly<T,Storage>& a);
394 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
395 log(
const OrthogPoly<T,Storage>& a);
397 template <
typename T,
typename Storage>
void 398 log(OrthogPoly<T,Storage>& c,
const OrthogPoly<T,Storage>& a);
400 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
401 log10(
const OrthogPoly<T,Storage>& a);
403 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
404 sqrt(
const OrthogPoly<T,Storage>& a);
406 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
407 cbrt(
const OrthogPoly<T,Storage>& a);
409 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
410 pow(
const OrthogPoly<T,Storage>& a,
const OrthogPoly<T,Storage>& b);
412 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
414 const OrthogPoly<T,Storage>& b);
416 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
417 pow(
const OrthogPoly<T,Storage>& a,
420 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
421 cos(
const OrthogPoly<T,Storage>& a);
423 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
424 sin(
const OrthogPoly<T,Storage>& a);
426 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
427 tan(
const OrthogPoly<T,Storage>& a);
429 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
430 cosh(
const OrthogPoly<T,Storage>& a);
432 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
433 sinh(
const OrthogPoly<T,Storage>& a);
435 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
436 tanh(
const OrthogPoly<T,Storage>& a);
438 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
439 acos(
const OrthogPoly<T,Storage>& a);
441 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
442 asin(
const OrthogPoly<T,Storage>& a);
444 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
445 atan(
const OrthogPoly<T,Storage>& a);
447 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
448 atan2(
const OrthogPoly<T,Storage>& a,
const OrthogPoly<T,Storage>& b);
450 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
452 const OrthogPoly<T,Storage>& b);
454 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
455 atan2(
const OrthogPoly<T,Storage>& a,
458 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
459 acosh(
const OrthogPoly<T,Storage>& a);
461 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
462 asinh(
const OrthogPoly<T,Storage>& a);
464 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
465 atanh(
const OrthogPoly<T,Storage>& a);
467 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
468 abs(
const OrthogPoly<T,Storage>& a);
470 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
471 fabs(
const OrthogPoly<T,Storage>& a);
473 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
474 max(
const OrthogPoly<T,Storage>& a,
const OrthogPoly<T,Storage>& b);
476 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
478 const OrthogPoly<T,Storage>& b);
480 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
481 max(
const OrthogPoly<T,Storage>& a,
484 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
485 min(
const OrthogPoly<T,Storage>& a,
const OrthogPoly<T,Storage>& b);
487 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
489 const OrthogPoly<T,Storage>& b);
491 template <
typename T,
typename Storage> OrthogPoly<T,Storage>
492 min(
const OrthogPoly<T,Storage>& a,
495 template <
typename T,
typename Storage>
bool 497 const OrthogPoly<T,Storage>& b);
499 template <
typename T,
typename Storage>
bool 501 const OrthogPoly<T,Storage>& b);
503 template <
typename T,
typename Storage>
bool 507 template <
typename T,
typename Storage>
bool 509 const OrthogPoly<T,Storage>& b);
511 template <
typename T,
typename Storage>
bool 513 const OrthogPoly<T,Storage>& b);
515 template <
typename T,
typename Storage>
bool 519 template <
typename T,
typename Storage>
bool 520 operator<=(const OrthogPoly<T,Storage>& a,
521 const OrthogPoly<T,Storage>& b);
523 template <
typename T,
typename Storage>
bool 525 const OrthogPoly<T,Storage>& b);
527 template <
typename T,
typename Storage>
bool 528 operator<=(const OrthogPoly<T,Storage>& a,
531 template <
typename T,
typename Storage>
bool 533 const OrthogPoly<T,Storage>& b);
535 template <
typename T,
typename Storage>
bool 537 const OrthogPoly<T,Storage>& b);
539 template <
typename T,
typename Storage>
bool 543 template <
typename T,
typename Storage>
bool 544 operator<(const OrthogPoly<T,Storage>& a,
545 const OrthogPoly<T,Storage>& b);
547 template <
typename T,
typename Storage>
bool 549 const OrthogPoly<T,Storage>& b);
551 template <
typename T,
typename Storage>
bool 552 operator<(const OrthogPoly<T,Storage>& a,
555 template <
typename T,
typename Storage>
bool 556 operator>(
const OrthogPoly<T,Storage>& a,
557 const OrthogPoly<T,Storage>& b);
559 template <
typename T,
typename Storage>
bool 561 const OrthogPoly<T,Storage>& b);
563 template <
typename T,
typename Storage>
bool 564 operator>(
const OrthogPoly<T,Storage>& a,
567 template <
typename T,
typename Storage> std::ostream&
568 operator << (std::ostream& os, const OrthogPoly<T,Storage>& a);
570 template <
typename T,
typename Storage> std::istream&
571 operator >> (std::istream& os, OrthogPoly<T,Storage>& a);
580 #endif // HAVE_STOKHOS_SACADO 582 #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)