48 template <
typename ordinal_type,
typename value_type>
55 bool limit_integration_order_) :
57 limit_integration_order(limit_integration_order_),
58 pce_sz(pce.basis()->size()),
59 pce_norms(pce.basis()->norm_squared()),
62 basis_vecs(pce_sz, p+1),
83 pce_vals[i] = normalized_pce.
evaluate(quad_points[i], basis_values[i]);
92 for (
typename Cijk_type::k_iterator k_it = Cijk.
k_begin();
93 k_it != Cijk.
k_end(); ++k_it) {
95 for (
typename Cijk_type::kj_iterator j_it = Cijk.
j_begin(k_it);
96 j_it != Cijk.
j_end(k_it); ++j_it) {
99 for (
typename Cijk_type::kji_iterator i_it = Cijk.
i_begin(j_it);
100 i_it != Cijk.
i_end(j_it); ++i_it) {
131 std::cout << K << std::endl << std::endl;
139 &ws_size_query, -1, &info);
141 "GEQRF returned value " << info);
145 &work[0], ws_size, &info);
147 "GEQRF returned value " << info);
151 &ws_size_query, -1, &info);
153 "ORGQR returned value " << info);
155 work.resize(ws_size);
157 &work[0], ws_size, &info);
159 "ORGQR returned value " << info);
181 a[pce_sz-1] = T(pce_sz-1,pce_sz-1);
189 u[i] = normalized_pce[i];
196 template <
typename ordinal_type,
typename value_type>
202 template <
typename ordinal_type,
typename value_type>
210 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
220 if (limit_integration_order && quad_order > 2*this->p)
221 quad_order = 2*this->p;
228 if (quad_weights.
size() < num_points) {
230 quad_weights.
resize(num_points);
231 quad_points.
resize(num_points);
232 quad_values.resize(num_points);
235 quad_points[i] = quad_points[0];
236 quad_values[i].
resize(this->p+1);
237 evaluateBases(quad_points[i], quad_values[i]);
242 template <
typename ordinal_type,
typename value_type>
251 template <
typename ordinal_type,
typename value_type>
259 template <
typename ordinal_type,
typename value_type>
272 out[i] /= pce_norms[i];
275 template <
typename ordinal_type,
typename value_type>
291 std::cout <<
"i = " << i <<
" alpha = " << alpha[i] <<
" beta = " << beta[i]
292 <<
" gamma = " << gamma[i] << std::endl;
298 template <
typename ordinal_type,
typename value_type>
302 limit_integration_order(basis.limit_integration_order),
303 pce_sz(basis.pce_sz),
304 pce_norms(basis.pce_norms),
307 basis_vecs(basis.basis_vecs),
308 new_pce(basis.new_pce)
ScalarType * values() const
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
void ORGQR(const OrdinalType &m, const OrdinalType &n, const OrdinalType &k, ScalarType *A, const OrdinalType &lda, const ScalarType *TAU, ScalarType *WORK, const OrdinalType &lwork, OrdinalType *info) const
#define TEUCHOS_FUNC_TIME_MONITOR(FUNCNAME)
value_type getNewCoeffs(ordinal_type i) const
Get new coefficients in this new basis.
Generates three-term recurrence using the Lanczos procedure applied to a polynomial chaos expansion i...
Teuchos::Array< value_type > norms
Norms.
Implementation of OneDOrthogPolyBasis based on the general three-term recurrence relationship: for ...
k_iterator k_begin() const
Iterator pointing to first k entry.
value_type evaluate(const Teuchos::Array< value_type > &point) const
Evaluate polynomial approximation at a point.
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
void GEMV(ETransp trans, const OrdinalType &m, const OrdinalType &n, const alpha_type alpha, const A_type *A, const OrdinalType &lda, const x_type *x, const OrdinalType &incx, const beta_type beta, ScalarType *y, const OrdinalType &incy) const
int multiply(ETransp transa, ETransp transb, ScalarType alpha, const SerialDenseMatrix< OrdinalType, ScalarType > &A, const SerialDenseMatrix< OrdinalType, ScalarType > &B, ScalarType beta)
virtual void getQuadPoints(ordinal_type quad_order, Teuchos::Array< value_type > &points, Teuchos::Array< value_type > &weights, Teuchos::Array< Teuchos::Array< value_type > > &values) const
Compute quadrature points, weights, and values of basis polynomials at given set of points points...
kj_iterator j_begin(const k_iterator &k) const
Iterator pointing to first j entry for given k.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual ordinal_type size() const =0
Get number of quadrature points.
virtual const Teuchos::Array< Teuchos::Array< value_type > > & getBasisAtQuadPoints() const =0
Get values of basis at quadrature points.
matrix_type basis_vecs
Basis vectors.
virtual Teuchos::RCP< OneDOrthogPolyBasis< ordinal_type, value_type > > cloneWithOrder(ordinal_type p) const
Clone this object with the option of building a higher order basis.
kj_iterator j_end(const k_iterator &k) const
Iterator pointing to last j entry for given k.
virtual const Teuchos::Array< value_type > & getQuadWeights() const =0
Get quadrature weights.
virtual const Teuchos::Array< Teuchos::Array< value_type > > & getQuadPoints() const =0
Get quadrature points.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Abstract base class for quadrature methods.
KOKKOS_INLINE_FUNCTION PCE< Storage > ceil(const PCE< Storage > &a)
~MonoProjPCEBasis()
Destructor.
void transformCoeffs(const value_type *in, value_type *out) const
Map expansion coefficients from this basis to original.
void resize(size_type new_size, const value_type &x=value_type())
Teuchos::Array< value_type > pce_norms
Basis norms.
virtual void getQuadPoints(ordinal_type quad_order, Teuchos::Array< value_type > &points, Teuchos::Array< value_type > &weights, Teuchos::Array< Teuchos::Array< value_type > > &values) const
Get Gauss quadrature points, weights, and values of basis at points.
k_iterator k_end() const
Iterator pointing to last k entry.
Stokhos::Sparse3Tensor< int, double > Cijk_type
virtual void setup()
Setup basis after computing recurrence coefficients.
ordinal_type pce_sz
Size of PC expansion.
void GEQRF(const OrdinalType &m, const OrdinalType &n, ScalarType *A, const OrdinalType &lda, ScalarType *TAU, ScalarType *WORK, const OrdinalType &lwork, OrdinalType *info) const
Teuchos::Array< value_type > b
Stores full set of beta coefficients.
Teuchos::Array< value_type > a
Stores full set of alpha coefficients.
ordinal_type p
Order of basis.
MonoProjPCEBasis(ordinal_type p, const Stokhos::OrthogPolyApprox< ordinal_type, value_type > &pce, const Stokhos::Quadrature< ordinal_type, value_type > &quad, const Stokhos::Sparse3Tensor< ordinal_type, value_type > &Cijk, bool limit_integration_order=false)
Constructor.
vector_type new_pce
Projection of pce in new basis.
kji_iterator i_begin(const kj_iterator &j) const
Iterator pointing to first i entry for given j and k.
virtual bool computeRecurrenceCoefficients(ordinal_type n, Teuchos::Array< value_type > &alpha, Teuchos::Array< value_type > &beta, Teuchos::Array< value_type > &delta, Teuchos::Array< value_type > &gamma) const
Compute recurrence coefficients.
kji_iterator i_end(const kj_iterator &j) const
Iterator pointing to last i entry for given j and k.
OrdinalType stride() const