37 template <
typename Func>
127 namespace StieltjesCosTest {
129 template <
typename Ordinal_Type,
typename Value_Type>
146 setup.st_1d_basis->transformCoeffsFromStieltjes(
setup.u_st.coeff(),
156 setup.st_quad->getBasisAtQuadPoints();
159 for (
int i=0; i<
setup.st_sz; i++) {
161 for (
unsigned int k=0; k<weights.
size(); k++)
162 mat(i,
j) += weights[k]*values[k][i]*values[k][
j];
169 out <<
"\n Error, mat.normInf() < atol = " << mat.
normInf()
170 <<
" < " <<
setup.atol <<
": failed!\n";
171 out <<
"mat = " <<
printMat(mat) << std::endl;
186 "v_st.mean()",
setup.v_st.mean(),
196 setup.v.standard_deviation(),
197 "v_st.standard_devaition()",
198 setup.v_st.standard_deviation(),
210 namespace StieltjesSinTest {
212 template <
typename Ordinal_Type,
typename Value_Type>
229 setup.st_1d_basis->transformCoeffsFromStieltjes(
setup.u_st.coeff(),
239 setup.st_quad->getBasisAtQuadPoints();
242 for (
int i=0; i<
setup.st_sz; i++) {
244 for (
unsigned int k=0; k<weights.
size(); k++)
245 mat(i,
j) += weights[k]*values[k][i]*values[k][
j];
252 out <<
"\n Error, mat.normInf() < atol = " << mat.
normInf()
253 <<
" < " <<
setup.atol <<
": failed!\n";
254 out <<
"mat = " <<
printMat(mat) << std::endl;
269 "v_st.mean()",
setup.v_st.mean(),
278 setup.v.standard_deviation(),
279 "v_st.standard_devaition()",
280 setup.v_st.standard_deviation(),
293 namespace StieltjesExpTest {
295 template <
typename Ordinal_Type,
typename Value_Type>
312 setup.st_1d_basis->transformCoeffsFromStieltjes(
setup.u_st.coeff(),
322 setup.st_quad->getBasisAtQuadPoints();
325 for (
int i=0; i<
setup.st_sz; i++) {
327 for (
unsigned int k=0; k<weights.
size(); k++)
328 mat(i,
j) += weights[k]*values[k][i]*values[k][
j];
335 out <<
"\n Error, mat.normInf() < atol = " << mat.
normInf()
336 <<
" < " <<
setup.atol <<
": failed!\n";
337 out <<
"mat = " <<
printMat(mat) << std::endl;
352 "v_st.mean()",
setup.v_st.mean(),
361 setup.v.standard_deviation(),
362 "v_st.standard_devaition()",
363 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)
bool testRelErr(const std::string &v1_name, const T1 &v1, const std::string &v2_name, const T2 &v2, const std::string &maxRelErr_error_name, const typename TestRelErr< T1, T2 >::magnitudeType &maxRelErr_error, const std::string &maxRelErr_warning_name, const typename TestRelErr< T1, T2 >::magnitudeType &maxRelErr_warning, const Ptr< std::ostream > &out)
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
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.