13 template <
typename ordinal_type,
typename value_type,
typename func_type>
19 bool use_pce_quad_points_,
24 pce_weights(quad->getQuadWeights()),
25 basis_values(quad->getBasisAtQuadPoints()),
28 use_pce_quad_points(use_pce_quad_points_)
34 template <
typename ordinal_type,
typename value_type,
typename func_type>
40 template <
typename ordinal_type,
typename value_type,
typename func_type>
48 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
53 if (use_pce_quad_points) {
54 quad_points = func_vals;
55 quad_weights = pce_weights;
56 quad_values = phi_vals;
65 if (quad_order > 2*this->p)
66 quad_order = 2*this->p;
73 if (quad_weights.
size() < num_points) {
75 quad_weights.
resize(num_points);
76 quad_points.
resize(num_points);
77 quad_values.resize(num_points);
80 quad_points[i] = quad_points[0];
81 quad_values[i].
resize(this->p+1);
82 this->evaluateBases(quad_points[i], quad_values[i]);
87 template <
typename ordinal_type,
typename value_type,
typename func_type>
101 stieltjes(0, n, pce_weights, func_vals, alpha, beta, nrm, vals);
114 template <
typename ordinal_type,
typename value_type,
typename func_type>
121 quad->getQuadPoints();
123 func_vals.resize(nqp);
124 phi_vals.resize(nqp);
126 func_vals[i] = (*func)(quad_points[i]);
127 phi_vals[i].resize(this->p+1);
133 template <
typename ordinal_type,
typename value_type,
typename func_type>
145 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
152 integrateBasisSquared(0, a, b, weights, points, phi_vals, val1, val2);
159 integrateBasisSquared(i, a, b, weights, points, phi_vals, val1, val2);
163 "Stokhos::StieltjesBasis::stieltjes(): "
164 <<
" Polynomial " << i <<
" out of " << nfinish
165 <<
" has norm " << val1
166 <<
"! Try increasing number of quadrature points");
169 b[i] = nrm[i]/nrm[i-1];
173 template <
typename ordinal_type,
typename value_type,
typename func_type>
184 evaluateRecurrence(k, a, b, points, phi_vals);
189 val1 += weights[i]*phi_vals[i][k]*phi_vals[i][k];
190 val2 += weights[i]*phi_vals[i][k]*phi_vals[i][k]*points[i];
194 template <
typename ordinal_type,
typename value_type,
typename func_type>
209 values[i][k] = points[i] - a[k-1];
213 (points[i] - a[k-1])*values[i][k-1] - b[k-1]*values[i][k-2];
216 template <
typename ordinal_type,
typename value_type,
typename func_type>
224 template <
typename ordinal_type,
typename value_type,
typename func_type>
230 pce_weights(quad->getQuadWeights()),
231 basis_values(quad->getBasisAtQuadPoints()),
234 use_pce_quad_points(basis.use_pce_quad_points)
StieltjesBasis(ordinal_type p, const Teuchos::RCP< const func_type > &func, const Teuchos::RCP< const Stokhos::Quadrature< ordinal_type, value_type > > &quad, bool use_pce_quad_points, bool normalize=false)
Constructor.
#define TEUCHOS_FUNC_TIME_MONITOR(FUNCNAME)
Implementation of OneDOrthogPolyBasis based on the general three-term recurrence relationship: for ...
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.
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...
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void stieltjes(ordinal_type nstart, ordinal_type nfinish, const Teuchos::Array< value_type > &weights, const Teuchos::Array< value_type > &points, Teuchos::Array< value_type > &a, Teuchos::Array< value_type > &b, Teuchos::Array< value_type > &nrm, Teuchos::Array< Teuchos::Array< value_type > > &phi_vals) const
Compute 3-term recurrence using Stieljtes procedure.
Generates three-term recurrence using the Discretized Stieltjes procedure applied to a functional map...
virtual void setup()
Setup basis after computing recurrence coefficients.
~StieltjesBasis()
Destructor.
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)
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.
void resize(size_type new_size, const value_type &x=value_type())
void integrateBasisSquared(ordinal_type k, const Teuchos::Array< value_type > &a, const Teuchos::Array< value_type > &b, const Teuchos::Array< value_type > &weights, const Teuchos::Array< value_type > &points, Teuchos::Array< Teuchos::Array< value_type > > &phi_vals, value_type &val1, value_type &val2) const
Compute and .
virtual void setup()
Setup basis after computing recurrence coefficients.
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.
void evaluateRecurrence(ordinal_type k, const Teuchos::Array< value_type > &a, const Teuchos::Array< value_type > &b, const Teuchos::Array< value_type > &points, Teuchos::Array< Teuchos::Array< value_type > > &values) const
Evaluate polynomials via 3-term recurrence.