16 template <
typename ordinal_type,
typename value_type>
23 name(
"Monomial Proj Gram Schmidt PCE Basis"),
25 pce_basis(pce[0].basis()),
26 pce_sz(pce_basis->size()),
29 verbose(params.get(
"Verbose", false)),
30 rank_threshold(params.get(
"Rank Threshold", 1.0e-12)),
31 orthogonalization_method(params.get(
"Orthogonalization Method",
38 if (pce[i].standard_deviation() > 1.0e-15)
41 d = non_const_pce.
size();
59 if (quad_params.
isParameter(
"Reduced Quadrature Method") &&
60 quad_params.
get<std::string>(
"Reduced Quadrature Method") ==
"Q2") {
63 value_type rank_threshold2 = quad_params.
get(
"Q2 Rank Threshold",
78 bases[i] = prod_basis->getCoordinateBases()[i]->cloneWithOrder(2*max_p);
82 std::cout <<
"built new basis of dimension " << basis2->dimension()
83 <<
" and order " << basis2->order()
84 <<
" with total size " << basis2->size() << std::endl;
92 std::cout <<
"built new quadrature with total size " << quad2->size()
97 pce2[i].reset(basis2);
104 buildQ(2*max_p, rank_threshold2, pce2, quad2, terms2, num_terms2,
111 quad->getQuadPoints();
117 SDM AA(nqp, pce_sz2);
120 basis2->evaluateBases(points[i], basis_vals);
122 AA(i,
j) = basis_vals[
j];
146 template <
typename ordinal_type,
typename value_type>
164 quad->getQuadPoints();
166 quad->getBasisAtQuadPoints();
174 A_(i,
j) = basis_values[i][
j];
180 pce_norms[
j] += (pce[
j])[i]*(pce[
j])[i]*pce_basis_->norm_squared(i);
194 F_(i,
j) = pce[
j].evaluate(points[i], basis_values[i]);
199 CPBUtils::compute_terms(max_p, d, max_sz, terms_, num_terms_);
217 SDM Bp(pce_sz_, max_sz);
219 pce_basis_->norm_squared();
224 Bp(i,
j) += weights[k]*B(k,
j)*A_(k,i);
225 Bp(i,
j) /= basis_norms[i];
233 nrm += Bp(i,
j)*Bp(i,
j)*basis_norms[i];
245 for (
int i=0; i<d+1; i++)
249 orthogonalization_method, threshold, verbose, Bp, w, Qp_, R, piv);
254 template <
typename ordinal_type,
typename value_type>
260 template <
typename ordinal_type,
typename value_type>
268 template <
typename ordinal_type,
typename value_type>
276 template <
typename ordinal_type,
typename value_type>
284 template <
typename ordinal_type,
typename value_type>
292 template <
typename ordinal_type,
typename value_type>
300 template <
typename ordinal_type,
typename value_type>
309 template <
typename ordinal_type,
typename value_type>
318 template <
typename ordinal_type,
typename value_type>
326 template <
typename ordinal_type,
typename value_type>
335 template <
typename ordinal_type,
typename value_type>
343 template <
typename ordinal_type,
typename value_type>
348 os <<
"Gram-Schmidt basis of order " << p <<
", dimension " << d
349 <<
", and size " << sz <<
". Matrix coefficients:\n";
351 os <<
"Basis vector norms (squared):\n\t";
353 os << norms[i] <<
" ";
357 template <
typename ordinal_type,
typename value_type>
379 template <
typename ordinal_type,
typename value_type>
401 template <
typename ordinal_type,
typename value_type>
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
virtual void evaluateBases(const Teuchos::ArrayView< const value_type > &point, Teuchos::Array< value_type > &basis_vals) const
Evaluate basis polynomials at given point point.
virtual Teuchos::RCP< const Stokhos::UserDefinedQuadrature< ordinal_type, value_type > > createReducedQuadrature(const Teuchos::SerialDenseMatrix< ordinal_type, value_type > &Q, const Teuchos::SerialDenseMatrix< ordinal_type, value_type > &Q2, const Teuchos::SerialDenseMatrix< ordinal_type, value_type > &F, const Teuchos::Array< value_type > &weights) const
Get reduced quadrature object.
virtual const std::string & getName() const
Return string name of basis.
Teuchos::RCP< const Stokhos::Quadrature< ordinal_type, value_type > > reduced_quad
Reduced quadrature object.
virtual Teuchos::RCP< const Stokhos::Quadrature< ordinal_type, value_type > > getReducedQuadrature() const
Get reduced quadrature object.
SerialBandDenseMatrixPrinter< OrdinalType, ScalarType > printMat(const SerialBandDenseMatrix< OrdinalType, ScalarType > &obj)
MonomialProjGramSchmidtPCEBasis2(ordinal_type p, const Teuchos::Array< Stokhos::OrthogPolyApprox< ordinal_type, value_type > > &pce, const Teuchos::RCP< const Stokhos::Quadrature< ordinal_type, value_type > > &quad, const Teuchos::ParameterList ¶ms=Teuchos::ParameterList())
Constructor.
ordinal_type d
Total dimension of basis.
KOKKOS_INLINE_FUNCTION PCE< Storage > pow(const PCE< Storage > &a, const PCE< Storage > &b)
T & get(ParameterList &l, const std::string &name)
int multiply(ETransp transa, ETransp transb, ScalarType alpha, const SerialDenseMatrix< OrdinalType, ScalarType > &A, const SerialDenseMatrix< OrdinalType, ScalarType > &B, ScalarType beta)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
RCP< ParameterList > sublist(const RCP< ParameterList > ¶mList, const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
ordinal_type buildQ(ordinal_type max_p, value_type threshold, const Teuchos::Array< Stokhos::OrthogPolyApprox< ordinal_type, value_type > > &pce, const Teuchos::RCP< const Stokhos::Quadrature< ordinal_type, value_type > > &quad, Teuchos::Array< Stokhos::MultiIndex< ordinal_type > > &terms_, Teuchos::Array< ordinal_type > &num_terms_, Teuchos::SerialDenseMatrix< ordinal_type, value_type > &Qp_, Teuchos::SerialDenseMatrix< ordinal_type, value_type > &A_, Teuchos::SerialDenseMatrix< ordinal_type, value_type > &F_)
Build the reduced basis, parameterized by total order max_p.
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensor() const
Compute triple product tensor.
int quad2(const Epetra_Map &map, bool verbose)
bool isParameter(const std::string &name) const
SDM Q
Values of transformed basis at quadrature points.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
value_type rank_threshold
Rank threshold.
virtual value_type evaluateZero(ordinal_type i) const
Evaluate basis polynomial i at zero.
Abstract base class for quadrature methods.
ordinal_type order() const
Return order of basis.
virtual void transformToOriginalBasis(const value_type *in, value_type *out, ordinal_type ncol=1, bool transpose=false) const
Transform coefficients to original basis from this basis.
Abstract base class for multivariate orthogonal polynomials generated from tensor products of univari...
void resize(size_type new_size, const value_type &x=value_type())
Multivariate orthogonal polynomial basis generated from a total-order complete-polynomial tensor prod...
Generate a basis from a given set of PCE expansions that is orthogonal with respect to the product me...
ordinal_type sz
Total size of basis.
void push_back(const value_type &x)
Teuchos::ParameterList params
Algorithm parameters.
virtual ~MonomialProjGramSchmidtPCEBasis2()
Destructor.
int reshape(OrdinalType numRows, OrdinalType numCols)
virtual const Teuchos::Array< value_type > & norm_squared() const
Return array storing norm-squared of each basis polynomial.
ordinal_type dimension() const
Return dimension of basis.
SDM Qp
Coefficients of transformed basis in original basis.
virtual ordinal_type size() const
Return total size of basis.
Teuchos::Array< value_type > norms
Norms.
Teuchos::Array< Stokhos::MultiIndex< ordinal_type > > terms
2-D array of basis terms
#define TEUCHOS_ASSERT(assertion_test)
virtual void transformFromOriginalBasis(const value_type *in, value_type *out, ordinal_type ncol=1, bool transpose=false) const
Transform coefficients from original basis to this basis.
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeLinearTripleProductTensor() const
Compute linear triple product tensor where k = 0,1,..,d.
Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > pce_basis
Original pce basis.
virtual void print(std::ostream &os) const
Print basis to stream os.
Teuchos::Array< ordinal_type > num_terms
Number of terms up to each order.
Defines quadrature for a tensor product basis by tensor products of 1-D quadrature rules...
OrdinalType numRows() const
Encapsulate various orthogonalization (ie QR) methods.