11 typename point_compare_type>
12 template <
typename coeff_compare_type>
16 bool use_smolyak_apply,
18 const point_compare_type& point_compare) :
19 use_smolyak(use_smolyak_apply),
20 points(point_compare) {
23 typedef typename smolyak_basis_type::tensor_product_basis_type tensor_product_basis_type;
41 point_growth_index[
j] =
60 for (; op_set_iterator != op_set_end; ++op_set_iterator) {
67 si->second.first += c*w;
76 si->second.second = idx;
92 for (; op_iterator != op_end; ++op_iterator) {
131 typename point_compare_type>
142 transformQP2PCE_smolyak(alpha, input, result, beta, trans);
144 apply_direct(qp2pce, alpha, input, result, beta, trans);
148 typename point_compare_type>
166 apply_direct(pce2qp, alpha, input, result, beta, trans);
170 typename point_compare_type>
201 typename point_compare_type>
222 gather(gather_maps[i], input, trans, op_input);
223 op->transformQP2PCE(smolyak_coeffs[i], op_input, op_result, 0.0, trans);
224 scatter(scatter_maps[i], op_result, trans, result);
229 typename point_compare_type>
252 gather(scatter_maps[i], input, trans, op_input);
253 op->transformPCE2QP(smolyak_coeffs[i], op_input, op_result, 0.0, trans);
254 scatter(gather_maps[i], op_result, trans, result);
259 typename point_compare_type>
270 result(i,
j) = input(i,map[
j]);
275 result(i,
j) = input(map[i],
j);
280 typename point_compare_type>
291 result(i,map[
j]) += input(i,j);
296 result(map[i],
j) += input(i,
j);
ScalarType * values() const
Teuchos::SerialDenseMatrix< ordinal_type, value_type > pce2qp
Matrix mapping coefficients to points.
point_set_type::iterator set_iterator
void apply_direct(const Teuchos::SerialDenseMatrix< ordinal_type, value_type > &A, const value_type &alpha, const Teuchos::SerialDenseMatrix< ordinal_type, value_type > &input, Teuchos::SerialDenseMatrix< ordinal_type, value_type > &result, const value_type &beta, bool trans) const
Apply transformation operator using direct method.
point_map_type point_map
Map index to sparse grid term.
Teuchos::SerialDenseMatrix< ordinal_type, value_type > qp2pce
Matrix mapping points to coefficients.
Container storing a term in a generalized tensor product.
Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > getCoordinateBases() const
Return coordinate bases.
set_iterator set_begin()
Iterator to begining of point set.
ordinal_type getNumSmolyakTerms() const
Return number of terms in Smolyak formula.
int scale(const ScalarType alpha)
ordinal_type getSmolyakCoefficient(ordinal_type i) const
Return ith smolyak coefficient.
iterator end()
Iterator to end of point set.
Teuchos::Array< Teuchos::Array< ordinal_type > > gather_maps
Gather maps for each operator for Smolyak apply.
set_iterator set_end()
Iterator to end of point set.
Teuchos::Array< Teuchos::Array< ordinal_type > > scatter_maps
Scatter maps for each operator for Smolyak apply.
virtual void evaluateBases(const Teuchos::ArrayView< const value_type > &point, Teuchos::Array< value_type > &basis_vals) const
Evaluate basis polynomials at given point point.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
ordinal_type coeff_sz
Number of coefficients.
int putScalar(const ScalarType value=Teuchos::ScalarTraits< ScalarType >::zero())
void transformQP2PCE(const value_type &alpha, const Teuchos::SerialDenseMatrix< ordinal_type, value_type > &input, Teuchos::SerialDenseMatrix< ordinal_type, value_type > &result, const value_type &beta, bool trans=false) const
Transform values at quadrature points to PCE coefficients.
void transformPCE2QP_smolyak(const value_type &alpha, const Teuchos::SerialDenseMatrix< ordinal_type, value_type > &input, Teuchos::SerialDenseMatrix< ordinal_type, value_type > &result, const value_type &beta, bool trans) const
Transform PCE coefficients to values at quadrature points using Smolyak formula.
void scatter(const Teuchos::Array< ordinal_type > &map, const Teuchos::SerialDenseMatrix< ordinal_type, value_type > &input, bool trans, Teuchos::SerialDenseMatrix< ordinal_type, value_type > &result) const
base_type::iterator iterator
void gather(const Teuchos::Array< ordinal_type > &map, const Teuchos::SerialDenseMatrix< ordinal_type, value_type > &input, bool trans, Teuchos::SerialDenseMatrix< ordinal_type, value_type > &result) const
Teuchos::Array< value_type > smolyak_coeffs
Smolyak coefficients.
void resize(size_type new_size, const value_type &x=value_type())
Multivariate orthogonal polynomial basis generated from a Smolyak sparse grid.
ordinal_type dimension() const
Return dimension of basis.
OrdinalType numCols() const
void push_back(const value_type &x)
virtual ordinal_type size() const
Return total size of basis.
base_type::set_iterator set_iterator
int reshape(OrdinalType numRows, OrdinalType numCols)
ordinal_type point_size() const
Number of points.
Teuchos::RCP< const tensor_product_basis_type > getTensorProductBasis(ordinal_type i) const
Return ith tensor product basis.
virtual ordinal_type index(const MultiIndex< ordinal_type > &term) const
Get index of the multivariate polynomial given orders of each coordinate.
void transformQP2PCE_smolyak(const value_type &alpha, const Teuchos::SerialDenseMatrix< ordinal_type, value_type > &input, Teuchos::SerialDenseMatrix< ordinal_type, value_type > &result, const value_type &beta, bool trans) const
Transform values at quadrature points to PCE coefficients using Smolyak formula.
TEUCHOSCOMM_LIB_DLL_EXPORT void scatter(const int sendBuf[], const int sendCount, int recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
SmolyakPseudoSpectralOperator(const SmolyakBasis< ordinal_type, value_type, coeff_compare_type > &smolyak_basis, bool use_smolyak_apply=true, bool use_pst=true, const point_compare_type &point_compare=point_compare_type())
Constructor.
const point_type & point(ordinal_type n) const
Get point for given index.
iterator begin()
Iterator to begining of point set.
TensorProductPseudoSpectralOperator< ordinal_type, value_type > operator_type
#define TEUCHOS_ASSERT(assertion_test)
virtual const Teuchos::Array< value_type > & norm_squared() const
Return array storing norm-squared of each basis polynomial.
OrdinalType stride() const
virtual void transformPCE2QP(const value_type &alpha, const Teuchos::SerialDenseMatrix< ordinal_type, value_type > &input, Teuchos::SerialDenseMatrix< ordinal_type, value_type > &result, const value_type &beta, bool trans=false) const
Transform PCE coefficients to quadrature values.
bool use_smolyak
Use Smolyak apply method.
OrdinalType numRows() const
point_set_type points
Smolyak sparse grid.
operator_set_type operators
Tensor pseudospectral operators.