71 template <
typename Func>
161 namespace StieltjesCosTest {
163 template <
typename Ordinal_Type,
typename Value_Type>
180 setup.st_1d_basis->transformCoeffsFromStieltjes(
setup.u_st.coeff(),
190 setup.st_quad->getBasisAtQuadPoints();
193 for (
int i=0; i<
setup.st_sz; i++) {
195 for (
unsigned int k=0; k<weights.
size(); k++)
196 mat(i,
j) += weights[k]*values[k][i]*values[k][
j];
203 out <<
"\n Error, mat.normInf() < atol = " << mat.
normInf()
204 <<
" < " <<
setup.atol <<
": failed!\n";
205 out <<
"mat = " <<
printMat(mat) << std::endl;
220 "v_st.mean()",
setup.v_st.mean(),
230 setup.v.standard_deviation(),
231 "v_st.standard_devaition()",
232 setup.v_st.standard_deviation(),
244 namespace StieltjesSinTest {
246 template <
typename Ordinal_Type,
typename Value_Type>
263 setup.st_1d_basis->transformCoeffsFromStieltjes(
setup.u_st.coeff(),
273 setup.st_quad->getBasisAtQuadPoints();
276 for (
int i=0; i<
setup.st_sz; i++) {
278 for (
unsigned int k=0; k<weights.
size(); k++)
279 mat(i,
j) += weights[k]*values[k][i]*values[k][
j];
286 out <<
"\n Error, mat.normInf() < atol = " << mat.
normInf()
287 <<
" < " <<
setup.atol <<
": failed!\n";
288 out <<
"mat = " <<
printMat(mat) << std::endl;
303 "v_st.mean()",
setup.v_st.mean(),
312 setup.v.standard_deviation(),
313 "v_st.standard_devaition()",
314 setup.v_st.standard_deviation(),
327 namespace StieltjesExpTest {
329 template <
typename Ordinal_Type,
typename Value_Type>
346 setup.st_1d_basis->transformCoeffsFromStieltjes(
setup.u_st.coeff(),
356 setup.st_quad->getBasisAtQuadPoints();
359 for (
int i=0; i<
setup.st_sz; i++) {
361 for (
unsigned int k=0; k<weights.
size(); k++)
362 mat(i,
j) += weights[k]*values[k][i]*values[k][
j];
369 out <<
"\n Error, mat.normInf() < atol = " << mat.
normInf()
370 <<
" < " <<
setup.atol <<
": failed!\n";
371 out <<
"mat = " <<
printMat(mat) << std::endl;
386 "v_st.mean()",
setup.v_st.mean(),
395 setup.v.standard_deviation(),
396 "v_st.standard_devaition()",
397 setup.v_st.standard_deviation(),
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
Teuchos::RCP< const Stokhos::Quadrature< OrdinalType, ValueType > > st_quad
void sin(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
void eval(Stokhos::QuadOrthogPolyExpansion< OrdinalType, ValueType > &exp, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &x, Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &u)
void times(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a, const OrthogPolyApprox< ordinal_type, value_type, node_type > &b)
static const bool is_even
value_type evaluate(const Teuchos::Array< value_type > &point) const
Evaluate polynomial approximation at a point.
TEUCHOS_UNIT_TEST(Stokhos_StieltjesPCEBasis, ExpMap)
SerialBandDenseMatrixPrinter< OrdinalType, ScalarType > printMat(const SerialBandDenseMatrix< OrdinalType, ScalarType > &obj)
void exp(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
Stieltjes_PCE_Setup< Stieltjes_Sin_Func< int, double > > setup(true)
void cos(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
bool comparePCEs(const PCEType &a1, const std::string &a1_name, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a2, const std::string &a2_name, const ValueType &rel_tol, const ValueType &abs_tol, Teuchos::FancyOStream &out)
pointer coeff()
Return coefficient array.
void eval(Stokhos::QuadOrthogPolyExpansion< OrdinalType, ValueType > &exp, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &x, Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &u)
Stieltjes_PCE_Setup< Stieltjes_Cos_Func< int, double > > setup(true)
static const bool is_even
static int runUnitTestsFromMain(int argc, char *argv[])
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void reset(const Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > &new_basis, ordinal_type sz=0)
Reset to a new basis.
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensor() const
Compute triple product tensor.
Stieltjes_PCE_Setup(bool use_pce_quad_points_)
double operator()(const double &a) const
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > u_st
TEUCHOS_UNIT_TEST(Stokhos_StieltjesPCEBasis, CosMap)
Teuchos::RCP< const Stokhos::CompletePolynomialBasis< OrdinalType, ValueType > > st_basis
value_type mean() const
Compute mean of expansion.
KOKKOS_INLINE_FUNCTION PCE< Storage > exp(const PCE< Storage > &a)
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > u
int main(int argc, char **argv)
ScalarTraits< ScalarType >::magnitudeType normInf() const
Teuchos::Array< double > vec
Teuchos::RCP< const Stokhos::StieltjesPCEBasis< OrdinalType, ValueType > > st_1d_basis
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > v
Teuchos::RCP< Stokhos::QuadOrthogPolyExpansion< OrdinalType, ValueType > > exp
Func::ValueType ValueType
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > v_st
const Stokhos::OrthogPolyBasis< int, double > & basis
stieltjes_pce_quad_func(const Stokhos::OrthogPolyApprox< int, double > &pce_, const Stokhos::OrthogPolyBasis< int, double > &basis_)
virtual ordinal_type size() const
Return total size of basis.
TEUCHOS_UNIT_TEST(Stokhos_StieltjesPCEBasis, SinMap)
static const bool is_even
const Stokhos::OrthogPolyApprox< int, double > & pce
bool testRelErr(const std::string &v1_name, const Scalar &v1, const std::string &v2_name, const Scalar &v2, const std::string &maxRelErr_error_name, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &maxRelErr_error, const std::string &maxRelErr_warning_name, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &maxRelErr_warning, const Ptr< std::ostream > &out)
Teuchos::RCP< const Stokhos::CompletePolynomialBasis< OrdinalType, ValueType > > basis
Stieltjes_PCE_Setup< Stieltjes_Exp_Func< int, double > > setup(false)
Func::OrdinalType OrdinalType
Defines quadrature for a tensor product basis by tensor products of 1-D quadrature rules...
void eval(Stokhos::QuadOrthogPolyExpansion< OrdinalType, ValueType > &exp, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &x, Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &u)
reference term(ordinal_type dimension, ordinal_type order)
Get coefficient term for given dimension and order.