18 template <
typename ordinal_type,
typename value_type>
26 name(
"Product Lanczos Gram-Schmidt PCE Basis"),
31 pce_sz = pce_basis->size();
37 coord_bases = prod_basis->getCoordinateBases();
40 bool project =
params.
get(
"Project",
true);
41 bool normalize =
params.
get(
"Normalize",
true);
42 bool limit_integration_order =
params.
get(
"Limit Integration Order",
false);
43 bool use_stieltjes =
params.
get(
"Use Old Stieltjes Method",
false);
54 if (is_invariant[i] >= 0) {
55 coordinate_bases.
push_back(coord_bases[is_invariant[i]]);
60 else if (is_invariant[i] != -1) {
66 normalize, project, Cijk)));
74 normalize, limit_integration_order)));
80 normalize, limit_integration_order)));
84 d = coordinate_bases.
size();
91 params.
get(
"Cijk Drop Tolerance", 1.0e-15),
92 params.
get(
"Use Old Cijk Algorithm",
false)));
97 quad->getQuadPoints();
99 quad->getBasisAtQuadPoints();
104 Psi(i,k) = basis_vals[k][i]*weights[k]/pce_basis->norm_squared(i);
112 for (
int k=0; k<nqp; k++) {
114 for (
int j=0;
j<pce.size();
j++) {
117 if (is_invariant[
j] != -1) {
120 if (is_invariant[
j] >= 0)
121 pce_vals[jdx] = points[k][is_invariant[
j]];
123 pce_vals[jdx] = pce[
j].evaluate(points[k], basis_vals[k]);
124 F(k,jdx) = pce_vals[jdx];
131 for (
int i=0; i<
sz; i++)
132 Phi(i,k) = red_basis_vals[i];
135 bool verbose =
params.
get(
"Verbose",
false);
148 nrm += A(i,
j)*A(i,
j)*basis_norms[i];
158 std::string orthogonalization_method =
159 params.
get(
"Orthogonalization Method",
"Householder");
163 for (
int i=0; i<
d+1; i++)
166 sz = SOF::createOrthogonalBasis(
167 orthogonalization_method, rank_threshold, verbose, A, w,
Qp, R, piv);
174 B(i,
j) = basis_vals[i][
j];
185 reduced_quad = quad_factory.createReducedQuadrature(
Q, Q2, F, weights);
191 template <
typename ordinal_type,
typename value_type>
197 template <
typename ordinal_type,
typename value_type>
205 template <
typename ordinal_type,
typename value_type>
213 template <
typename ordinal_type,
typename value_type>
221 template <
typename ordinal_type,
typename value_type>
229 template <
typename ordinal_type,
typename value_type>
237 template <
typename ordinal_type,
typename value_type>
246 template <
typename ordinal_type,
typename value_type>
255 template <
typename ordinal_type,
typename value_type>
263 template <
typename ordinal_type,
typename value_type>
272 template <
typename ordinal_type,
typename value_type>
277 os <<
"Product Lanczos Gram-Schmidt basis of order " << p <<
", dimension "
279 <<
", and size " << sz <<
". Matrix coefficients:\n";
281 os <<
"Basis vector norms (squared):\n\t";
283 os << norms[i] <<
" ";
287 template <
typename ordinal_type,
typename value_type>
295 template <
typename ordinal_type,
typename value_type>
317 template <
typename ordinal_type,
typename value_type>
339 template <
typename ordinal_type,
typename value_type>
347 template <
typename ordinal_type,
typename value_type>
366 tmp_pce.reset(basis);
368 ordinal_type p = prod_basis->getCoordinateBases()[i]->order();
371 tmp_pce.term(i,
j) = pce.
term(i,
j);
373 if (nrm > tol) dependent_dims.
push_back(i);
378 if (dependent_dims.
size() == 1)
379 return dependent_dims[0];
382 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.
SerialBandDenseMatrixPrinter< OrdinalType, ScalarType > printMat(const SerialBandDenseMatrix< OrdinalType, ScalarType > &obj)
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.