18 namespace DerivExpansionUnitTest {
21 template <
typename OrdinalType,
typename ValueType>
32 Stokhos::OrthogPolyApprox<OrdinalType,ValueType> x,
y,
u,
u2,
cx,
cu,
cu2,
sx,
su,
su2;
41 const OrdinalType d = 1;
42 const OrdinalType p = 7;
46 for (OrdinalType i=0; i<d; i++)
79 for (OrdinalType i=0; i<d; i++) {
84 for (OrdinalType i=0; i<d; i++)
98 OrdinalType nqp = weights.
size();
101 for (OrdinalType i=0; i<c.
size(); i++)
106 for (OrdinalType k=0; k<nqp; k++) {
109 for (
int i=0; i<c.
size(); i++)
114 template <
class Func>
125 OrdinalType nqp = weights.
size();
128 for (OrdinalType i=0; i<c.
size(); i++)
133 for (OrdinalType k=0; k<nqp; k++) {
134 ValueType val1 = a.
evaluate(points[k], values[k]);
135 ValueType val2 = b.
evaluate(points[k], values[k]);
136 ValueType
val = func(val1, val2);
137 for (
int i=0; i<c.
size(); i++)
142 template <
class Func>
154 OrdinalType nqp = weights.
size();
157 for (OrdinalType i=0; i<c.
size(); i++)
162 for (OrdinalType k=0; k<nqp; k++) {
163 ValueType val2 = b.
evaluate(points[k], values[k]);
164 ValueType
val = func(a, val2);
165 for (
int i=0; i<c.
size(); i++)
170 template <
class Func>
182 OrdinalType nqp = weights.
size();
185 for (OrdinalType i=0; i<c.
size(); i++)
190 for (OrdinalType k=0; k<nqp; k++) {
191 ValueType val1 = a.
evaluate(points[k], values[k]);
192 ValueType
val = func(val1, b);
193 for (
int i=0; i<c.
size(); i++)
259 return 0.5*
std::log((1.0+a)/(1.0-a));
264 double operator() (
double a,
double b)
const {
return a + b; }
267 double operator() (
double a,
double b)
const {
return a - b; }
270 double operator() (
double a,
double b)
const {
return a * b; }
273 double operator() (
double a,
double b)
const {
return a / b; }
666 setup.exp->plus(ru, v, w);
782 setup.exp->minus(ru, v, w);
898 setup.exp->times(ru, v, w);
1014 setup.exp->divide(ru, v, w);
1199 setup.exp->plusEqual(ru, v);
1252 setup.exp->minusEqual(ru, v);
1253 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)
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > u2
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > cx
double operator()(double a) const
virtual Teuchos::RCP< Teuchos::SerialDenseMatrix< ordinal_type, value_type > > computeDerivDoubleProductTensor() const
Compute double product tensor where represents the derivative of in the direction ...
double operator()(double a) const
KOKKOS_INLINE_FUNCTION PCE< Storage > sinh(const PCE< Storage > &a)
double operator()(double a) const
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > su2
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, double b) const
double operator()(double a) const
Teuchos::RCP< const Stokhos::Quadrature< OrdinalType, ValueType > > quad
Teuchos::RCP< Stokhos::Dense3Tensor< int, double > > Dijk
KOKKOS_INLINE_FUNCTION PCE< Storage > pow(const PCE< Storage > &a, const PCE< Storage > &b)
void computePCE2(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &b)
void computePCE2LC(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, ValueType a, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &b)
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) const
virtual const Teuchos::Array< Teuchos::Array< value_type > > & getBasisAtQuadPoints() const =0
Get values of basis at quadrature points.
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > u
double operator()(double a) const
double operator()(double a) const
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > sx
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
double operator()(double a) const
KOKKOS_INLINE_FUNCTION PCE< Storage > acos(const PCE< Storage > &a)
Teuchos::RCP< const Stokhos::CompletePolynomialBasis< OrdinalType, ValueType > > basis
virtual const Teuchos::Array< value_type > & getQuadWeights() const =0
Get quadrature weights.
Teuchos::RCP< Stokhos::DerivOrthogPolyExpansion< OrdinalType, ValueType > > exp
double operator()(double a, double b) const
double operator()(double a) const
virtual const Teuchos::Array< Teuchos::Array< value_type > > & getQuadPoints() const =0
Get quadrature points.
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > su
static int runUnitTestsFromMain(int argc, char *argv[])
Teuchos::RCP< Stokhos::Sparse3Tensor< int, double > > Cijk
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::Dense3Tensor< ordinal_type, value_type > > computeDerivTripleProductTensor(const Teuchos::RCP< const Teuchos::SerialDenseMatrix< ordinal_type, value_type > > &Bij, const Teuchos::RCP< const Stokhos::Sparse3Tensor< ordinal_type, value_type > > &Cijk) const
Compute triple product tensor where represents the derivative of in the direction ...
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensor() const
Compute triple product tensor.
KOKKOS_INLINE_FUNCTION PCE< Storage > cosh(const PCE< Storage > &a)
double operator()(double a) const
double operator()(double a) const
TEUCHOS_UNIT_TEST(Stokhos_DerivExpansion, UMinus)
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, double > > Bij
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > cu2
KOKKOS_INLINE_FUNCTION PCE< Storage > atan(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > exp(const PCE< Storage > &a)
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > y
UnitTestSetup< int, double > setup
int main(int argc, char **argv)
double operator()(double a) const
double operator()(double a) const
ScalarType f(const Teuchos::Array< ScalarType > &x, double a, double b)
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > x
double operator()(double a, double b) const
virtual ordinal_type size() const
Return total size of basis.
KOKKOS_INLINE_FUNCTION PCE< Storage > sin(const PCE< Storage > &a)
ordinal_type size() const
Return size.
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > cu
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)
double operator()(double a) const
virtual const Teuchos::Array< value_type > & norm_squared() const
Return array storing norm-squared of each basis polynomial.
KOKKOS_INLINE_FUNCTION PCE< Storage > asin(const PCE< Storage > &a)
double operator()(double a) const
KOKKOS_INLINE_FUNCTION PCE< Storage > cos(const PCE< Storage > &a)
Defines quadrature for a tensor product basis by tensor products of 1-D quadrature rules...
void computePCE2RC(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a, ValueType b)
double operator()(double a, double b) const
reference term(ordinal_type dimension, ordinal_type order)
Get coefficient term for given dimension and order.
void computePCE1(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a)