78 const Teuchos::SerialDenseMatrix<ordinal_type,value_type>& A,
79 const Teuchos::SerialDenseMatrix<ordinal_type,value_type>& F,
80 const Teuchos::Array<value_type>& weights,
82 Teuchos::Array<ordinal_type>& num_terms_,
83 Teuchos::SerialDenseMatrix<ordinal_type,value_type>& Qp_,
84 Teuchos::SerialDenseMatrix<ordinal_type,value_type>& Q_)
88 CPBUtils::compute_terms(max_p, this->d, max_sz, terms_, num_terms_);
96 ordinal_type nqp = weights.size();
98 for (ordinal_type i=0; i<nqp; i++) {
99 for (ordinal_type
j=0;
j<max_sz;
j++) {
101 for (ordinal_type k=0; k<this->d; k++)
102 B(i,
j) *= std::pow(F(i,k), terms_[
j][k]);
107 for (ordinal_type
j=0;
j<max_sz;
j++) {
108 value_type nrm = 0.0;
109 for (ordinal_type i=0; i<nqp; i++)
110 nrm += B(i,
j)*B(i,
j)*weights[i];
111 nrm = std::sqrt(nrm);
112 for (ordinal_type i=0; i<nqp; i++)
120 Teuchos::Array<ordinal_type> piv(max_sz);
121 for (
int i=0; i<this->d+1; i++)
124 ordinal_type sz_ = SOF::createOrthogonalBasis(
125 this->orthogonalization_method, threshold, this->verbose, B, weights,
130 Qp_.reshape(this->pce_sz, sz_);
131 for (ordinal_type i=0; i<nqp; i++)
132 for (ordinal_type
j=0;
j<sz_;
j++)
133 tmp(i,
j) = Q_(i,
j)*weights[i];
135 Qp_.multiply(Teuchos::TRANS, Teuchos::NO_TRANS, 1.0, A, tmp, 0.0);
136 TEUCHOS_ASSERT(ret == 0);
MonomialGramSchmidtPCEBasis(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 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_)
Build the reduced basis, parameterized by total order max_p.