18 namespace AlgebraicExpansionUnitTest {
21 template <
typename OrdinalType,
typename ValueType>
31 Stokhos::OrthogPolyApprox<OrdinalType,ValueType> x,
y,
u,
u2,
cx,
cu,
cu2,
sx,
su,
su2;
40 const OrdinalType d = 2;
41 const OrdinalType p = 7;
45 for (OrdinalType i=0; i<d; i++)
83 for (OrdinalType i=0; i<d; i++) {
88 for (OrdinalType i=0; i<d; i++)
102 OrdinalType nqp = weights.
size();
105 for (OrdinalType i=0; i<c.
size(); i++)
110 for (OrdinalType k=0; k<nqp; k++) {
113 for (
int i=0; i<c.
size(); i++)
118 template <
class Func>
129 OrdinalType nqp = weights.
size();
132 for (OrdinalType i=0; i<c.
size(); i++)
137 for (OrdinalType k=0; k<nqp; k++) {
138 ValueType val1 = a.
evaluate(points[k], values[k]);
139 ValueType val2 = b.
evaluate(points[k], values[k]);
140 ValueType
val = func(val1, val2);
141 for (
int i=0; i<c.
size(); i++)
146 template <
class Func>
158 OrdinalType nqp = weights.
size();
161 for (OrdinalType i=0; i<c.
size(); i++)
166 for (OrdinalType k=0; k<nqp; k++) {
167 ValueType val2 = b.
evaluate(points[k], values[k]);
168 ValueType
val = func(a, val2);
169 for (
int i=0; i<c.
size(); i++)
174 template <
class Func>
186 OrdinalType nqp = weights.
size();
189 for (OrdinalType i=0; i<c.
size(); i++)
194 for (OrdinalType k=0; k<nqp; k++) {
195 ValueType val1 = a.
evaluate(points[k], values[k]);
196 ValueType
val = func(val1, b);
197 for (
int i=0; i<c.
size(); i++)
222 return 0.5*
std::log((1.0+a)/(1.0-a));
227 double operator() (
double a,
double b)
const {
return a + b; }
230 double operator() (
double a,
double b)
const {
return a - b; }
233 double operator() (
double a,
double b)
const {
return a * b; }
236 double operator() (
double a,
double b)
const {
return a / b; }
405 setup.exp->plus(ru, v, w);
521 setup.exp->minus(ru, v, w);
637 setup.exp->times(ru, v, w);
796 setup.exp->plusEqual(ru, v);
849 setup.exp->minusEqual(ru, v);
850 setup.exp->unaryMinus(v, v);
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > cu2
KOKKOS_INLINE_FUNCTION PCE< Storage > tan(const PCE< Storage > &a)
Teuchos::RCP< Stokhos::AlgebraicOrthogPolyExpansion< OrdinalType, ValueType > > exp
KOKKOS_INLINE_FUNCTION PCE< Storage > sinh(const PCE< Storage > &a)
TEUCHOS_UNIT_TEST(Stokhos_AlgebraicExpansion, UMinus)
value_type evaluate(const Teuchos::Array< value_type > &point) const
Evaluate polynomial approximation at a point.
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > cu
double operator()(double a, double b) const
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeLinearTripleProductTensor() const
Compute linear triple product tensor where k = 0,1,..,d.
Teuchos::RCP< const Stokhos::CompletePolynomialBasis< OrdinalType, ValueType > > basis
KOKKOS_INLINE_FUNCTION PCE< Storage > pow(const PCE< Storage > &a, const PCE< Storage > &b)
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > su2
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > cx
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > su
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > sx
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)
virtual const Teuchos::Array< Teuchos::Array< value_type > > & getBasisAtQuadPoints() const =0
Get values of basis at quadrature points.
void computePCE2LC(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, ValueType a, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &b)
KOKKOS_INLINE_FUNCTION PCE< Storage > tanh(const PCE< Storage > &a)
Teuchos::RCP< Stokhos::QuadOrthogPolyExpansion< OrdinalType, ValueType > > qexp
KOKKOS_INLINE_FUNCTION PCE< Storage > cbrt(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > acos(const PCE< Storage > &a)
virtual const Teuchos::Array< value_type > & getQuadWeights() const =0
Get quadrature weights.
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > u2
virtual const Teuchos::Array< Teuchos::Array< value_type > > & getQuadPoints() const =0
Get quadrature points.
Teuchos::RCP< Stokhos::Sparse3Tensor< int, double > > Cijk
static int runUnitTestsFromMain(int argc, char *argv[])
double operator()(double a) const
double operator()(double a, double b) const
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.
void computePCE2(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &b)
UnitTestSetup< int, double > setup
double operator()(double a, double b) const
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
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::RCP< Stokhos::Sparse3Tensor< int, double > > Cijk_linear
int main(int argc, char **argv)
double operator()(double a) const
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > u
ScalarType f(const Teuchos::Array< ScalarType > &x, double a, double b)
void computePCE1(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a)
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.
Teuchos::RCP< const Stokhos::Quadrature< OrdinalType, ValueType > > quad
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > x
KOKKOS_INLINE_FUNCTION PCE< Storage > log(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > log10(const PCE< Storage > &a)
double operator()(double a, double b) 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)
void computePCE2RC(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a, ValueType b)
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...
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > y
reference term(ordinal_type dimension, ordinal_type order)
Get coefficient term for given dimension and order.
Teuchos::RCP< Stokhos::AlgebraicOrthogPolyExpansion< OrdinalType, ValueType > > exp_linear