16 template <
typename ordinal_type,
typename value_type>
24 name(
"Product Lanczos PCE Basis"),
34 coord_bases = prod_basis->getCoordinateBases();
37 bool project =
params.
get(
"Project",
true);
38 bool normalize =
params.
get(
"Normalize",
true);
39 bool limit_integration_order =
params.
get(
"Limit Integration Order",
false);
40 bool use_stieltjes =
params.
get(
"Use Old Stieltjes Method",
false);
51 if (is_invariant[i] >= 0) {
52 coordinate_bases.
push_back(coord_bases[is_invariant[i]]);
57 else if (is_invariant[i] != -1) {
63 normalize, project, Cijk)));
71 normalize, limit_integration_order)));
77 normalize, limit_integration_order)));
88 params.
get(
"Cijk Drop Tolerance", 1.0e-15),
89 params.
get(
"Use Old Cijk Algorithm",
false)));
101 quad->getQuadPoints();
103 quad->getBasisAtQuadPoints();
105 SDM Psi(pce_sz, nqp);
108 Psi(i,k) = basis_vals[k][i]*weights[k]/pce_basis->norm_squared(i);
115 for (
int k=0; k<nqp; k++) {
117 for (
int j=0;
j<pce.size();
j++) {
120 if (is_invariant[
j] != -1) {
123 if (is_invariant[
j] >= 0)
124 pce_vals[jdx] = points[k][is_invariant[
j]];
126 pce_vals[jdx] = pce[
j].evaluate(points[k], basis_vals[k]);
133 for (
int i=0; i<sz; i++)
134 Phi(i,k) = red_basis_vals[i];
137 bool verbose =
params.
get(
"Verbose",
false);
158 Vt(i,
j) = Vt(i,
j) / sigma[i];
164 std::cout <<
"rank = " << rank << std::endl;
166 std::cout <<
"diag(S) = [";
168 std::cout << sigma[i] <<
" ";
169 std::cout <<
"]" << std::endl;
175 SVt(i,
j) = Vt(i,
j) * sigma[i] * sigma[i];
177 SDM err_A(pce_sz,sz);
182 std::cout <<
"||A - U*S*V^T||_infty = " << err_A.
normInf() << std::endl;
193 std::cout <<
"||Ainv*A - I||_infty = " << err.
normInf() << std::endl;
197 SDM err2(pce_sz,pce_sz);
203 std::cout <<
"||A*Ainv - I||_infty = " << err2.
normInf() << std::endl;
208 template <
typename ordinal_type,
typename value_type>
214 template <
typename ordinal_type,
typename value_type>
219 return tensor_lanczos_basis->order();
222 template <
typename ordinal_type,
typename value_type>
227 return tensor_lanczos_basis->dimension();
230 template <
typename ordinal_type,
typename value_type>
235 return tensor_lanczos_basis->size();
238 template <
typename ordinal_type,
typename value_type>
243 return tensor_lanczos_basis->norm_squared();
246 template <
typename ordinal_type,
typename value_type>
251 return tensor_lanczos_basis->norm_squared(i);
254 template <
typename ordinal_type,
typename value_type>
261 tensor_lanczos_basis->computeTripleProductTensor();
266 template <
typename ordinal_type,
typename value_type>
273 tensor_lanczos_basis->computeLinearTripleProductTensor();
278 template <
typename ordinal_type,
typename value_type>
283 return tensor_lanczos_basis->evaluateZero(i);
286 template <
typename ordinal_type,
typename value_type>
292 return tensor_lanczos_basis->evaluateBases(point, basis_vals);
295 template <
typename ordinal_type,
typename value_type>
300 tensor_lanczos_basis->print(os);
303 template <
typename ordinal_type,
typename value_type>
311 template <
typename ordinal_type,
typename value_type>
316 return tensor_lanczos_basis->term(i);
319 template <
typename ordinal_type,
typename value_type>
324 return tensor_lanczos_basis->index(term);
327 template <
typename ordinal_type,
typename value_type>
332 return tensor_lanczos_basis->getCoordinateBases();
335 template <
typename ordinal_type,
typename value_type>
340 return tensor_lanczos_basis->getMaxOrders();
343 template <
typename ordinal_type,
typename value_type>
367 template <
typename ordinal_type,
typename value_type>
391 template <
typename ordinal_type,
typename value_type>
399 template <
typename ordinal_type,
typename value_type>
418 tmp_pce.reset(basis);
420 ordinal_type p = prod_basis->getCoordinateBases()[i]->order();
423 tmp_pce.term(i,
j) = pce.
term(i,
j);
425 if (nrm > tol) dependent_dims.
push_back(i);
430 if (dependent_dims.
size() == 1)
431 return dependent_dims[0];
434 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.