48 template <
typename ordinal_type,
typename value_type>
56 name(
"Product Lanczos PCE Basis"),
66 coord_bases = prod_basis->getCoordinateBases();
69 bool project =
params.
get(
"Project",
true);
70 bool normalize =
params.
get(
"Normalize",
true);
71 bool limit_integration_order =
params.
get(
"Limit Integration Order",
false);
72 bool use_stieltjes =
params.
get(
"Use Old Stieltjes Method",
false);
83 if (is_invariant[i] >= 0) {
84 coordinate_bases.
push_back(coord_bases[is_invariant[i]]);
89 else if (is_invariant[i] != -1) {
95 normalize, project, Cijk)));
103 normalize, limit_integration_order)));
109 normalize, limit_integration_order)));
120 params.
get(
"Cijk Drop Tolerance", 1.0e-15),
121 params.
get(
"Use Old Cijk Algorithm",
false)));
133 quad->getQuadPoints();
135 quad->getBasisAtQuadPoints();
137 SDM Psi(pce_sz, nqp);
140 Psi(i,k) = basis_vals[k][i]*weights[k]/pce_basis->norm_squared(i);
147 for (
int k=0; k<nqp; k++) {
149 for (
int j=0;
j<pce.size();
j++) {
152 if (is_invariant[
j] != -1) {
155 if (is_invariant[
j] >= 0)
156 pce_vals[jdx] = points[k][is_invariant[
j]];
158 pce_vals[jdx] = pce[
j].evaluate(points[k], basis_vals[k]);
165 for (
int i=0; i<sz; i++)
166 Phi(i,k) = red_basis_vals[i];
169 bool verbose =
params.
get(
"Verbose",
false);
190 Vt(i,
j) = Vt(i,
j) / sigma[i];
196 std::cout <<
"rank = " << rank << std::endl;
198 std::cout <<
"diag(S) = [";
200 std::cout << sigma[i] <<
" ";
201 std::cout <<
"]" << std::endl;
207 SVt(i,
j) = Vt(i,
j) * sigma[i] * sigma[i];
209 SDM err_A(pce_sz,sz);
214 std::cout <<
"||A - U*S*V^T||_infty = " << err_A.
normInf() << std::endl;
225 std::cout <<
"||Ainv*A - I||_infty = " << err.
normInf() << std::endl;
229 SDM err2(pce_sz,pce_sz);
235 std::cout <<
"||A*Ainv - I||_infty = " << err2.
normInf() << std::endl;
240 template <
typename ordinal_type,
typename value_type>
246 template <
typename ordinal_type,
typename value_type>
251 return tensor_lanczos_basis->order();
254 template <
typename ordinal_type,
typename value_type>
259 return tensor_lanczos_basis->dimension();
262 template <
typename ordinal_type,
typename value_type>
267 return tensor_lanczos_basis->size();
270 template <
typename ordinal_type,
typename value_type>
275 return tensor_lanczos_basis->norm_squared();
278 template <
typename ordinal_type,
typename value_type>
283 return tensor_lanczos_basis->norm_squared(i);
286 template <
typename ordinal_type,
typename value_type>
293 tensor_lanczos_basis->computeTripleProductTensor();
298 template <
typename ordinal_type,
typename value_type>
305 tensor_lanczos_basis->computeLinearTripleProductTensor();
310 template <
typename ordinal_type,
typename value_type>
315 return tensor_lanczos_basis->evaluateZero(i);
318 template <
typename ordinal_type,
typename value_type>
324 return tensor_lanczos_basis->evaluateBases(point, basis_vals);
327 template <
typename ordinal_type,
typename value_type>
332 tensor_lanczos_basis->print(os);
335 template <
typename ordinal_type,
typename value_type>
343 template <
typename ordinal_type,
typename value_type>
348 return tensor_lanczos_basis->term(i);
351 template <
typename ordinal_type,
typename value_type>
356 return tensor_lanczos_basis->index(term);
359 template <
typename ordinal_type,
typename value_type>
364 return tensor_lanczos_basis->getCoordinateBases();
367 template <
typename ordinal_type,
typename value_type>
372 return tensor_lanczos_basis->getMaxOrders();
375 template <
typename ordinal_type,
typename value_type>
399 template <
typename ordinal_type,
typename value_type>
423 template <
typename ordinal_type,
typename value_type>
431 template <
typename ordinal_type,
typename value_type>
450 tmp_pce.reset(basis);
452 ordinal_type p = prod_basis->getCoordinateBases()[i]->order();
455 tmp_pce.term(i,
j) = pce.
term(i,
j);
457 if (nrm > tol) dependent_dims.
push_back(i);
462 if (dependent_dims.
size() == 1)
463 return dependent_dims[0];
466 else if (dependent_dims.
size() == 0)
Generates three-term recurrence using the Lanczos procedure applied to a polynomial chaos expansion i...
virtual void print(std::ostream &os) const
Print basis to stream os.
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensor() const
Compute triple product tensor.
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)
SDM Phi
Values of transformed basis at quadrature points.
SDM Ainv
Projection matrix from original matrix to reduced.
RCP< ParameterList > sublist(const RCP< ParameterList > ¶mList, const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
virtual Teuchos::RCP< const Stokhos::Quadrature< ordinal_type, value_type > > getReducedQuadrature() const
Get reduced quadrature object.
virtual ~ProductLanczosPCEBasis()
Destructor.
ordinal_type svd_threshold(const scalar_type &rank_threshold, const Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &A, Teuchos::Array< scalar_type > &s, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &U, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &Vt)
ProductLanczosPCEBasis(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.
Generates three-term recurrence using the Discretized Stieltjes procedure applied to a polynomial cha...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual const std::string & getName() const
Return string name of basis.
virtual ordinal_type index(const MultiIndex< ordinal_type > &term) const
Get index of the multivariate polynomial given orders of each coordinate.
Abstract base class for quadrature methods.
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.
int putScalar(const ScalarType value=Teuchos::ScalarTraits< ScalarType >::zero())
ordinal_type dimension() const
Return dimension of basis.
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.
Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > basis() const
Return basis.
ordinal_type isInvariant(const Stokhos::OrthogPolyApprox< ordinal_type, value_type > &pce) const
Teuchos::ParameterList params
Algorithm parameters.
Abstract base class for multivariate orthogonal polynomials generated from tensor products of univari...
Multivariate orthogonal polynomial basis generated from a total-order complete-polynomial tensor prod...
Teuchos::RCP< Stokhos::CompletePolynomialBasis< ordinal_type, value_type > > tensor_lanczos_basis
Product Lanczos basis.
virtual MultiIndex< ordinal_type > getMaxOrders() const
Return maximum order allowable for each coordinate basis.
Teuchos::RCP< const Stokhos::Quadrature< ordinal_type, value_type > > reduced_quad
Reduced quadrature object.
OrdinalType numCols() const
virtual void evaluateBases(const Teuchos::ArrayView< const value_type > &point, Teuchos::Array< value_type > &basis_vals) const
Evaluate basis polynomials at given point point.
ScalarTraits< ScalarType >::magnitudeType normInf() const
void push_back(const value_type &x)
virtual ordinal_type size() const
Return total size of basis.
virtual const MultiIndex< ordinal_type > & term(ordinal_type i) const
Get orders of each coordinate polynomial given an index i.
virtual const Teuchos::Array< value_type > & norm_squared() const
Return array storing norm-squared of each basis polynomial.
ordinal_type order() const
Return order of basis.
static Teuchos::RCP< const Stokhos::Quadrature< ordinal_type, value_type > > create(Teuchos::ParameterList &sgParams)
Generate quadrature object.
int shape(OrdinalType numRows, OrdinalType numCols)
#define TEUCHOS_ASSERT(assertion_test)
SerialDenseMatrix< OrdinalType, ScalarType > & assign(const SerialDenseMatrix< OrdinalType, ScalarType > &Source)
Generates three-term recurrence using the Lanczos procedure applied to a polynomial chaos expansion i...
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeLinearTripleProductTensor() const
Compute linear triple product tensor where k = 0,1,..,d.
OrdinalType numRows() const
reference term(ordinal_type dimension, ordinal_type order)
Get coefficient term for given dimension and order.
Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > getCoordinateBases() const
Return coordinate bases.
virtual value_type evaluateZero(ordinal_type i) const
Evaluate basis polynomial i at zero.