44template <
typename ordinal_type,
typename value_type>
50 const Teuchos::ParameterList& params_) :
63template <
typename ordinal_type,
typename value_type>
73 Teuchos::Array< const Stokhos::OrthogPolyApprox<ordinal_type, value_type>* > pce2;
75 if (pce[i].standard_deviation() > 1.0e-15)
76 pce2.push_back(&pce[i]);
81 const Teuchos::Array<value_type>& weights = quad->getQuadWeights();
82 const Teuchos::Array< Teuchos::Array<value_type> >& points =
83 quad->getQuadPoints();
84 const Teuchos::Array< Teuchos::Array<value_type> >& basis_values =
85 quad->getBasisAtQuadPoints();
93 A(i,
j) = basis_values[i][
j];
96 Teuchos::Array<value_type> pce_norms(
d, 0.0);
99 pce_norms[
j] += (*pce2[
j])[i]*(*pce2[
j])[i]*
pce_basis->norm_squared(i);
100 pce_norms[
j] = std::sqrt(pce_norms[
j]);
110 Teuchos::Array< Teuchos::Array<value_type> > values(nqp);
113 F(i,
j) = pce2[
j]->evaluate(points[i], basis_values[i]);
120 Teuchos::ParameterList quad_params =
params.sublist(
"Reduced Quadrature");
124 if (quad_params.isParameter(
"Reduced Quadrature Method") &&
125 quad_params.get<std::string>(
"Reduced Quadrature Method") ==
"Q2") {
126 Teuchos::Array< Stokhos::MultiIndex<ordinal_type> > terms2;
127 Teuchos::Array<ordinal_type> num_terms2;
128 value_type rank_threshold2 = quad_params.get(
"Q2 Rank Threshold",
133 num_terms2, Qp2,
Q2);
141template <
typename ordinal_type,
typename value_type>
147template <
typename ordinal_type,
typename value_type>
155template <
typename ordinal_type,
typename value_type>
163template <
typename ordinal_type,
typename value_type>
171template <
typename ordinal_type,
typename value_type>
172const Teuchos::Array<value_type>&
179template <
typename ordinal_type,
typename value_type>
187template <
typename ordinal_type,
typename value_type>
188Teuchos::RCP< Stokhos::Sparse3Tensor<ordinal_type, value_type> >
193 return Teuchos::null;
196template <
typename ordinal_type,
typename value_type>
197Teuchos::RCP< Stokhos::Sparse3Tensor<ordinal_type, value_type> >
202 return Teuchos::null;
205template <
typename ordinal_type,
typename value_type>
210 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"Not implemented!");
213template <
typename ordinal_type,
typename value_type>
216evaluateBases(
const Teuchos::ArrayView<const value_type>& point,
217 Teuchos::Array<value_type>& basis_vals)
const
219 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"Not implemented!");
222template <
typename ordinal_type,
typename value_type>
225print(std::ostream& os)
const
227 os <<
"Gram-Schmidt basis of order " <<
p <<
", dimension " <<
d
228 <<
", and size " <<
sz <<
". Matrix coefficients:\n";
230 os <<
"Basis vector norms (squared):\n\t";
232 os <<
norms[i] <<
" ";
236template <
typename ordinal_type,
typename value_type>
244 SDM z(Teuchos::View, out, ncol, ncol,
pce_sz);
246 z.multiply(Teuchos::NO_TRANS, Teuchos::TRANS, 1.0, zbar,
Qp, 0.0);
247 TEUCHOS_ASSERT(ret == 0);
253 z.multiply(Teuchos::NO_TRANS, Teuchos::NO_TRANS, 1.0,
Qp, zbar, 0.0);
254 TEUCHOS_ASSERT(ret == 0);
258template <
typename ordinal_type,
typename value_type>
266 SDM zbar(Teuchos::View, out, ncol, ncol,
sz);
268 zbar.multiply(Teuchos::NO_TRANS, Teuchos::NO_TRANS, 1.0, z,
Qp, 0.0);
269 TEUCHOS_ASSERT(ret == 0);
273 SDM zbar(Teuchos::View, out,
sz,
sz, ncol);
275 zbar.multiply(Teuchos::TRANS, Teuchos::NO_TRANS, 1.0,
Qp, z, 0.0);
276 TEUCHOS_ASSERT(ret == 0);
280template <
typename ordinal_type,
typename value_type>
281Teuchos::RCP<const Stokhos::Quadrature<ordinal_type, value_type> >
virtual void evaluateBases(const Teuchos::ArrayView< const value_type > &point, Teuchos::Array< value_type > &basis_vals) const
Evaluate basis polynomials at given point point.
std::string orthogonalization_method
Orthogonalization method.
bool verbose
Whether to print a bunch of stuff out.
ordinal_type dimension() const
Return dimension of basis.
value_type rank_threshold
Rank threshold.
GSReducedPCEBasisBase(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.
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.
ordinal_type p
Total order of basis.
virtual ordinal_type buildReducedBasis(ordinal_type max_p, value_type threshold, const Teuchos::SerialDenseMatrix< ordinal_type, value_type > &A, const Teuchos::SerialDenseMatrix< ordinal_type, value_type > &F, const Teuchos::Array< value_type > &weights, 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 > &Q_)=0
Build the reduced basis, parameterized by total order max_p.
ordinal_type pce_sz
Size of original pce basis.
virtual value_type evaluateZero(ordinal_type i) const
Evaluate basis polynomial i at zero.
Teuchos::RCP< const Stokhos::Quadrature< ordinal_type, value_type > > reduced_quad
Reduced quadrature object.
void setup(ordinal_type p, const Teuchos::Array< Stokhos::OrthogPolyApprox< ordinal_type, value_type > > &pce, const Teuchos::RCP< const Stokhos::Quadrature< ordinal_type, value_type > > &quad)
virtual ordinal_type size() const
Return total size of basis.
Teuchos::SerialDenseMatrix< ordinal_type, value_type > SDM
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeLinearTripleProductTensor() const
Compute linear triple product tensor where k = 0,1,..,d.
virtual void print(std::ostream &os) const
Print basis to stream os.
SDM Qp
Coefficients of transformed basis in original basis.
ordinal_type order() const
Return order of basis.
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensor() const
Compute triple product tensor.
Teuchos::Array< Stokhos::MultiIndex< ordinal_type > > terms
2-D array of basis terms
SDM Q
Values of transformed basis at quadrature points.
ordinal_type d
Total dimension of basis.
Teuchos::Array< ordinal_type > num_terms
Number of terms up to each order.
ordinal_type sz
Total size of basis.
Teuchos::Array< value_type > norms
Norms.
Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > pce_basis
Original pce basis.
virtual Teuchos::RCP< const Stokhos::Quadrature< ordinal_type, value_type > > getReducedQuadrature() const
Get reduced quadrature object.
virtual const Teuchos::Array< value_type > & norm_squared() const
Return array storing norm-squared of each basis polynomial.
virtual ~GSReducedPCEBasisBase()
Destructor.
Teuchos::ParameterList params
Algorithm parameters.
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.
Class to store coefficients of a projection onto an orthogonal polynomial basis.
ordinal_type size() const
Return size.
Abstract base class for quadrature methods.
Generate a basis from a given set of PCE expansions that is orthogonal with respect to the product me...
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.
void printMat(const char *name, Epetra_IntSerialDenseMatrix &matrix)