15 template <
typename ordinal_type,
typename value_type,
typename node_type>
24 sz(this->basis->size()),
26 quad_points(quad->getQuadPoints()),
27 quad_weights(quad->getQuadWeights()),
28 quad_values(quad->getBasisAtQuadPoints()),
29 norms(this->basis->norm_squared()),
30 nqp(quad_points.size()),
50 template <
typename ordinal_type,
typename value_type,
typename node_type>
51 template <
typename FuncT>
73 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
84 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
91 fvals[qp] = func(avals[qp])*quad_weights[qp];
99 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
110 template <
typename ordinal_type,
typename value_type,
typename node_type>
111 template <
typename FuncT>
122 if (pa == 1 && pb == 1)
130 c[0] = func(a[0], b[0]);
135 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
148 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
155 fvals[qp] = func(avals[qp], bvals[qp])*quad_weights[qp];
162 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
173 template <
typename ordinal_type,
typename value_type,
typename node_type>
174 template <
typename FuncT>
192 c[0] = func(a, b[0]);
197 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
208 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
215 fvals[qp] = func(a, bvals[qp])*quad_weights[qp];
222 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
233 template <
typename ordinal_type,
typename value_type,
typename node_type>
234 template <
typename FuncT>
252 c[0] = func(a[0], b);
257 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
268 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
275 fvals[qp] = func(avals[qp], b)*quad_weights[qp];
282 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
293 template <
typename ordinal_type,
typename value_type,
typename node_type>
294 template <
typename FuncT>
301 const int N = FuncT::N;
303 for (
int i=0; i<N; i++) {
304 if (na[i]->size() > 1) {
319 for (
int i=0; i<N; i++)
320 val[i] = (*na[i])[0];
325 if (N >= navals.size())
327 if (navals[N].size() != N) {
329 for (
int i=0; i<N; i++)
330 navals[N][i].resize(nqp);
334 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
339 for (
int i=0; i<N; i++) {
342 blas.GEMV(
Teuchos::TRANS, pa, nqp, 1.0, &qv[0], sz, na[i]->coeff(), 1, 0.0,
343 &navals[N][i][0], 1);
349 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
357 for (
int i=0; i<N; i++)
358 val[i] = navals[N][i][qp];
359 fvals[qp] = func(val)*quad_weights[qp];
368 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
379 template <
typename ordinal_type,
typename value_type,
typename node_type>
389 template <
typename ordinal_type,
typename value_type,
typename node_type>
399 template <
typename ordinal_type,
typename value_type,
typename node_type>
406 if (use_quad_for_times)
412 template <
typename ordinal_type,
typename value_type,
typename node_type>
419 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
430 if (use_quad_for_division)
437 template <
typename ordinal_type,
typename value_type,
typename node_type>
444 if (use_quad_for_times)
450 template <
typename ordinal_type,
typename value_type,
typename node_type>
460 template <
typename ordinal_type,
typename value_type,
typename node_type>
470 template <
typename ordinal_type,
typename value_type,
typename node_type>
477 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
493 if (use_quad_for_division)
500 template <
typename ordinal_type,
typename value_type,
typename node_type>
507 if (use_quad_for_division)
513 template <
typename ordinal_type,
typename value_type,
typename node_type>
523 template <
typename ordinal_type,
typename value_type,
typename node_type>
532 template <
typename ordinal_type,
typename value_type,
typename node_type>
541 template <
typename ordinal_type,
typename value_type,
typename node_type>
550 template <
typename ordinal_type,
typename value_type,
typename node_type>
559 template <
typename ordinal_type,
typename value_type,
typename node_type>
568 template <
typename ordinal_type,
typename value_type,
typename node_type>
578 template <
typename ordinal_type,
typename value_type,
typename node_type>
588 template <
typename ordinal_type,
typename value_type,
typename node_type>
598 template <
typename ordinal_type,
typename value_type,
typename node_type>
607 template <
typename ordinal_type,
typename value_type,
typename node_type>
616 template <
typename ordinal_type,
typename value_type,
typename node_type>
625 template <
typename ordinal_type,
typename value_type,
typename node_type>
634 template <
typename ordinal_type,
typename value_type,
typename node_type>
643 template <
typename ordinal_type,
typename value_type,
typename node_type>
652 template <
typename ordinal_type,
typename value_type,
typename node_type>
661 template <
typename ordinal_type,
typename value_type,
typename node_type>
670 template <
typename ordinal_type,
typename value_type,
typename node_type>
679 template <
typename ordinal_type,
typename value_type,
typename node_type>
689 template <
typename ordinal_type,
typename value_type,
typename node_type>
699 template <
typename ordinal_type,
typename value_type,
typename node_type>
709 template <
typename ordinal_type,
typename value_type,
typename node_type>
718 template <
typename ordinal_type,
typename value_type,
typename node_type>
727 template <
typename ordinal_type,
typename value_type,
typename node_type>
736 template <
typename ordinal_type,
typename value_type,
typename node_type>
737 template <
typename ExprT1,
typename ExprT2>
745 if (pa > 1 && pb > 1) {
755 "Stokhos::QuadOrthogPolyExpansion::compute_times_coeff()"
756 <<
": Index " << i <<
" is out of range [0,"
757 << this->Cijk->num_i() <<
")!");
763 k_it != this->Cijk->k_end(i_it); ++k_it) {
770 aa = a.higher_order_coeff(k);
776 aa = b.higher_order_coeff(k);
779 j_it != this->Cijk->j_end(k_it); ++j_it) {
787 bb = b.higher_order_coeff(j);
793 bb = a.higher_order_coeff(j);
800 return cc / norms[i];
803 return a.val() * b.val();
805 return a.higher_order_coeff(i)*b.val();
808 return a.val()*b.higher_order_coeff(i);
812 template <
typename ordinal_type,
typename value_type,
typename node_type>
813 template <
typename ExprT1,
typename ExprT2>
821 "Stokhos::QuadOrthogPolyExpansion::fast_ompute_times_coeff()"
822 <<
": Index " << i <<
" is out of range [0,"
823 << this->Cijk->num_i() <<
")!");
829 k_it != this->Cijk->k_end(i_it); ++k_it) {
834 aa = a.higher_order_coeff(k);
836 j_it != this->Cijk->j_end(k_it); ++j_it) {
842 bb = b.higher_order_coeff(j);
847 return cc / norms[i];
void divideEqual(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const value_type &x)
const Teuchos::Array< value_type > & norms
Norms of basis vectors.
void binary_op(const FuncT &func, OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a, const OrthogPolyApprox< ordinal_type, value_type, node_type > &b)
Nonlinear binary function.
#define TEUCHOS_FUNC_TIME_MONITOR(FUNCNAME)
Teuchos::RCP< Teuchos::ParameterList > params
Parameter list.
void sin(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
void times(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a, const OrthogPolyApprox< ordinal_type, value_type, node_type > &b)
void sqrt(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
void resize(ordinal_type sz)
Resize coefficient array (coefficients are preserved)
ordinal_type nqp
Number of Quad points.
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
void acos(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
const Teuchos::Array< Teuchos::Array< value_type > > & quad_values
Values of basis at Quad points.
QuadOrthogPolyExpansion(const Teuchos::RCP< const OrthogPolyBasis< ordinal_type, value_type > > &basis, const Teuchos::RCP< const Stokhos::Sparse3Tensor< ordinal_type, value_type > > &Cijk, const Teuchos::RCP< const Quadrature< ordinal_type, value_type > > &quad, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Constructor.
void exp(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
T & get(ParameterList &l, const std::string &name)
void atanh(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void log10(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
void cos(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
void divide(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a, const OrthogPolyApprox< ordinal_type, value_type, node_type > &b)
Base class for consolidating common expansion implementations.
void asin(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
void timesEqual(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const value_type &x)
void atan(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
pointer coeff()
Return coefficient array.
ordinal_type sz
Expansions size.
Bi-directional iterator for traversing a sparse array.
void divide(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a, const OrthogPolyApprox< ordinal_type, value_type, node_type > &b)
value_type compute_times_coeff(ordinal_type k, const ExprT1 &a, const ExprT2 &b) const
Abstract base class for multivariate orthogonal polynomials.
void sinh(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
value_type fast_compute_times_coeff(ordinal_type k, const ExprT1 &a, const ExprT2 &b) const
Abstract base class for quadrature methods.
void atan2(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a, const OrthogPolyApprox< ordinal_type, value_type, node_type > &b)
void nary_op(const FuncT &func, OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > **a)
bool use_quad_for_times
Use quadrature for times functions.
Teuchos::Array< value_type > sqv
Quad values scaled by norms.
KOKKOS_INLINE_FUNCTION bool is_constant(const T &x)
void times(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a, const OrthogPolyApprox< ordinal_type, value_type, node_type > &b)
void log(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< is_view_uq_pce< view_type >::value, typename CijkType< view_type >::type >::type cijk(const view_type &view)
bool use_quad_for_division
Use quadrature for division functions.
Class to store coefficients of a projection onto an orthogonal polynomial basis.
void timesEqual(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const value_type &x)
void divideEqual(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const value_type &x)
void cbrt(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
void pow(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a, const OrthogPolyApprox< ordinal_type, value_type, node_type > &b)
void tanh(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
void tan(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
ordinal_type size() const
Return size.
void cosh(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
void asinh(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
Teuchos::Array< value_type > qv
Reshaped quad values into 1D array.
void unary_op(const FuncT &func, OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
Nonlinear unary function.
void acosh(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)