50 template <
typename ordinal_type,
typename value_type>
58 name(
"Product Lanczos Gram-Schmidt PCE Basis"),
63 pce_sz = pce_basis->size();
69 coord_bases = prod_basis->getCoordinateBases();
72 bool project =
params.
get(
"Project",
true);
73 bool normalize =
params.
get(
"Normalize",
true);
74 bool limit_integration_order =
params.
get(
"Limit Integration Order",
false);
75 bool use_stieltjes =
params.
get(
"Use Old Stieltjes Method",
false);
86 if (is_invariant[i] >= 0) {
87 coordinate_bases.
push_back(coord_bases[is_invariant[i]]);
92 else if (is_invariant[i] != -1) {
98 normalize, project, Cijk)));
106 normalize, limit_integration_order)));
112 normalize, limit_integration_order)));
116 d = coordinate_bases.
size();
123 params.
get(
"Cijk Drop Tolerance", 1.0e-15),
124 params.
get(
"Use Old Cijk Algorithm",
false)));
129 quad->getQuadPoints();
131 quad->getBasisAtQuadPoints();
136 Psi(i,k) = basis_vals[k][i]*weights[k]/pce_basis->norm_squared(i);
144 for (
int k=0; k<nqp; k++) {
146 for (
int j=0;
j<pce.size();
j++) {
149 if (is_invariant[
j] != -1) {
152 if (is_invariant[
j] >= 0)
153 pce_vals[jdx] = points[k][is_invariant[
j]];
155 pce_vals[jdx] = pce[
j].evaluate(points[k], basis_vals[k]);
156 F(k,jdx) = pce_vals[jdx];
163 for (
int i=0; i<
sz; i++)
164 Phi(i,k) = red_basis_vals[i];
167 bool verbose =
params.
get(
"Verbose",
false);
180 nrm += A(i,
j)*A(i,
j)*basis_norms[i];
190 std::string orthogonalization_method =
191 params.
get(
"Orthogonalization Method",
"Householder");
195 for (
int i=0; i<
d+1; i++)
198 sz = SOF::createOrthogonalBasis(
199 orthogonalization_method, rank_threshold, verbose, A, w,
Qp, R, piv);
206 B(i,
j) = basis_vals[i][
j];
217 reduced_quad = quad_factory.createReducedQuadrature(
Q, Q2, F, weights);
223 template <
typename ordinal_type,
typename value_type>
229 template <
typename ordinal_type,
typename value_type>
237 template <
typename ordinal_type,
typename value_type>
245 template <
typename ordinal_type,
typename value_type>
253 template <
typename ordinal_type,
typename value_type>
261 template <
typename ordinal_type,
typename value_type>
269 template <
typename ordinal_type,
typename value_type>
278 template <
typename ordinal_type,
typename value_type>
287 template <
typename ordinal_type,
typename value_type>
295 template <
typename ordinal_type,
typename value_type>
304 template <
typename ordinal_type,
typename value_type>
309 os <<
"Product Lanczos Gram-Schmidt basis of order " << p <<
", dimension "
311 <<
", and size " << sz <<
". Matrix coefficients:\n";
312 os << Qp << std::endl;
313 os <<
"Basis vector norms (squared):\n\t";
315 os << norms[i] <<
" ";
319 template <
typename ordinal_type,
typename value_type>
327 template <
typename ordinal_type,
typename value_type>
349 template <
typename ordinal_type,
typename value_type>
371 template <
typename ordinal_type,
typename value_type>
379 template <
typename ordinal_type,
typename value_type>
398 tmp_pce.reset(basis);
400 ordinal_type p = prod_basis->getCoordinateBases()[i]->order();
403 tmp_pce.term(i,
j) = pce.
term(i,
j);
405 if (nrm > tol) dependent_dims.
push_back(i);
410 if (dependent_dims.
size() == 1)
411 return dependent_dims[0];
414 else if (dependent_dims.
size() == 0)
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
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.
virtual value_type evaluateZero(ordinal_type i) const
Evaluate basis polynomial i at zero.
Generates three-term recurrence using the Lanczos procedure applied to a polynomial chaos expansion i...
ordinal_type p
Total order of basis.
Teuchos::RCP< const Stokhos::Quadrature< ordinal_type, value_type > > reduced_quad
Reduced quadrature object.
ordinal_type pce_sz
Size of original pce basis.
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
T & get(ParameterList &l, const std::string &name)
SDM Qp
Coefficients of transformed basis in original basis.
virtual void evaluateBases(const Teuchos::ArrayView< const value_type > &point, Teuchos::Array< value_type > &basis_vals) const
Evaluate basis polynomials at given point point.
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)
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeLinearTripleProductTensor() const
Compute linear triple product tensor where k = 0,1,..,d.
ordinal_type dimension() const
Return dimension of basis.
RCP< ParameterList > sublist(const RCP< ParameterList > ¶mList, const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
SDM Q
Values of transformed basis at quadrature points.
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensor() const
Compute triple product tensor.
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 ordinal_type size() const
Return total size of basis.
ordinal_type sz
Total size of basis.
ordinal_type order() const
Return order of basis.
Generates three-term recurrence using the Discretized Stieltjes procedure applied to a polynomial cha...
Teuchos::ParameterList params
Algorithm parameters.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Abstract base class for quadrature methods.
Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > basis() const
Return basis.
Abstract base class for multivariate orthogonal polynomials generated from tensor products of univari...
virtual ~ProductLanczosGramSchmidtPCEBasis()
Destructor.
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...
virtual void print(std::ostream &os) const
Print basis to stream os.
ordinal_type d
Total dimension of basis.
Generate a basis from a given set of PCE expansions that is orthogonal with respect to the product me...
virtual Teuchos::RCP< const Stokhos::Quadrature< ordinal_type, value_type > > getReducedQuadrature() const
Get reduced quadrature object.
void push_back(const value_type &x)
virtual const std::string & getName() const
Return string name of basis.
virtual const Teuchos::Array< value_type > & norm_squared() const
Return array storing norm-squared of each basis polynomial.
int reshape(OrdinalType numRows, OrdinalType numCols)
Teuchos::Array< value_type > norms
Norms.
Teuchos::RCP< Stokhos::CompletePolynomialBasis< ordinal_type, value_type > > tensor_lanczos_basis
Product Lanczos basis.
ProductLanczosGramSchmidtPCEBasis(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::RCP< const Stokhos::Sparse3Tensor< ordinal_type, value_type > > &Cijk, const Teuchos::ParameterList ¶ms=Teuchos::ParameterList())
Constructor.
#define TEUCHOS_ASSERT(assertion_test)
ordinal_type isInvariant(const Stokhos::OrthogPolyApprox< ordinal_type, value_type > &pce) const
Generates three-term recurrence using the Lanczos procedure applied to a polynomial chaos expansion i...
Encapsulate various orthogonalization (ie QR) methods.
reference term(ordinal_type dimension, ordinal_type order)
Get coefficient term for given dimension and order.