10 namespace PseudoSpectralExpansionUnitTest {
12 template <
class Func,
typename OrdinalType,
typename ValueType>
27 OrdinalType nqp = weights.
size();
30 for (OrdinalType i=0; i<c.
size(); i++)
35 for (OrdinalType k=0; k<nqp; k++) {
38 for (
int i=0; i<c.
size(); i++)
39 c[i] += weights[k]*val*values[k][i] / basis->norm_squared(i);
43 template <
class Func,
typename OrdinalType,
typename ValueType>
59 OrdinalType nqp = weights.
size();
62 for (OrdinalType i=0; i<c.
size(); i++)
67 for (OrdinalType k=0; k<nqp; k++) {
68 ValueType val1 = a.
evaluate(points[k], values[k]);
69 ValueType val2 = b.
evaluate(points[k], values[k]);
70 ValueType
val = func(val1, val2);
71 for (
int i=0; i<c.
size(); i++)
72 c[i] += weights[k]*val*values[k][i] / basis->norm_squared(i);
76 template <
class Func,
typename OrdinalType,
typename ValueType>
93 OrdinalType nqp = weights.
size();
96 for (OrdinalType i=0; i<c.
size(); i++)
101 for (OrdinalType k=0; k<nqp; k++) {
102 ValueType val2 = b.
evaluate(points[k], values[k]);
103 ValueType
val = func(a, val2);
104 for (
int i=0; i<c.
size(); i++)
105 c[i] += weights[k]*val*values[k][i] / basis->norm_squared(i);
109 template <
class Func,
typename OrdinalType,
typename ValueType>
126 OrdinalType nqp = weights.
size();
129 for (OrdinalType i=0; i<c.
size(); i++)
134 for (OrdinalType k=0; k<nqp; k++) {
135 ValueType val1 = a.
evaluate(points[k], values[k]);
136 ValueType
val = func(val1, b);
137 for (
int i=0; i<c.
size(); i++)
138 c[i] += weights[k]*val*values[k][i] / basis->norm_squared(i);
199 return 0.5*
std::log((1.0+a)/(1.0-a));
204 double operator() (
double a,
double b)
const {
return a + b; }
207 double operator() (
double a,
double b)
const {
return a - b; }
210 double operator() (
double a,
double b)
const {
return a * b; }
213 double operator() (
double a,
double b)
const {
return a / b; }
223 computePCE1<UMinusFunc>(
setup.u2, v, *
setup.quad);
559 computePCE2<PlusFunc>(
setup.u2, v, w, *
setup.quad);
606 setup.exp->plus(ru, v, w);
607 computePCE2<PlusFunc>(
setup.u2, v, w, *
setup.quad);
675 computePCE2<MinusFunc>(
setup.u2, v, w, *
setup.quad);
722 setup.exp->minus(ru, v, w);
723 computePCE2<MinusFunc>(
setup.u2, v, w, *
setup.quad);
791 computePCE2<TimesFunc>(
setup.u2, v, w, *
setup.quad);
838 setup.exp->times(ru, v, w);
839 computePCE2<TimesFunc>(
setup.u2, v, w, *
setup.quad);
923 computePCE2<DivideFunc>(
setup.u2, v, w, *
setup.quad);
970 setup.exp->divide(ru, v, w);
971 computePCE2<DivideFunc>(
setup.u2, v, w, *
setup.quad);
1155 setup.exp->plusEqual(ru, v);
1208 setup.exp->minusEqual(ru, v);
1209 setup.exp->unaryMinus(v, v);
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > tan(const PCE< Storage > &a)
void computePCE2LC(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, ValueType a, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &b, const Stokhos::Quadrature< OrdinalType, ValueType > &quad)
KOKKOS_INLINE_FUNCTION PCE< Storage > sinh(const PCE< Storage > &a)
value_type evaluate(const Teuchos::Array< value_type > &point) const
Evaluate polynomial approximation at a point.
double operator()(double a) const
double operator()(double a) const
double operator()(double a) const
KOKKOS_INLINE_FUNCTION PCE< Storage > pow(const PCE< Storage > &a, const PCE< Storage > &b)
double operator()(double a, double b) const
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)
double operator()(double a, double b) const
virtual const Teuchos::Array< Teuchos::Array< value_type > > & getBasisAtQuadPoints() const =0
Get values of basis at quadrature points.
double operator()(double a) const
double operator()(double a) const
void computePCE1(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a, const Stokhos::Quadrature< OrdinalType, ValueType > &quad)
double operator()(double a) const
KOKKOS_INLINE_FUNCTION PCE< Storage > tanh(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > cbrt(const PCE< Storage > &a)
double operator()(double a) const
UnitTestSetup< int, double > setup
void computePCE2RC(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a, ValueType b, const Stokhos::Quadrature< OrdinalType, ValueType > &quad)
double operator()(double a) const
double operator()(double a) const
KOKKOS_INLINE_FUNCTION PCE< Storage > acos(const PCE< Storage > &a)
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.
double operator()(double a, double b) const
KOKKOS_INLINE_FUNCTION PCE< Storage > cosh(const PCE< Storage > &a)
Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > basis() const
Return basis.
double operator()(double a) const
double operator()(double a) const
KOKKOS_INLINE_FUNCTION PCE< Storage > atan(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > exp(const PCE< Storage > &a)
double operator()(double a) const
TEUCHOS_UNIT_TEST(Stokhos_PSExpansion, UMinus)
ScalarType f(const Teuchos::Array< ScalarType > &x, double a, double b)
double operator()(double a) const
double operator()(double a) const
double operator()(double a) const
double operator()(double a) const
KOKKOS_INLINE_FUNCTION PCE< Storage > sin(const PCE< Storage > &a)
ordinal_type size() const
Return size.
void computePCE2(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &b, const Stokhos::Quadrature< OrdinalType, ValueType > &quad)
double operator()(double a, double b) const
double operator()(double a, double b) const
double operator()(double a) const
KOKKOS_INLINE_FUNCTION PCE< Storage > log(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > log10(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > asin(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > cos(const PCE< Storage > &a)
double operator()(double a) const