42 #include "Teuchos_Assert.hpp" 44 #include "Teuchos_ConfigDefs.hpp" 46 #define UQ_PREP_F77 F77_FUNC_(uq_prep,UQ_PREP) 47 #define UQ_PROD2_F77 F77_FUNC_(uq_prod2,UQ_PROD2) 48 #define UQ_DIV_F77 F77_FUNC_(uq_div,UQ_DIV) 49 #define UQ_EXP_F77 F77_FUNC_(uq_exp,UQ_EXP) 50 #define UQ_LOG_F77 F77_FUNC_(uq_log,UQ_LOG) 51 #define UQ_SQRT_F77 F77_FUNC_(uq_sqrt,UQ_SQRT) 52 #define UQ_EXP_INT_F77 F77_FUNC_(uq_exp_int,UQ_EXP) 53 #define UQ_LOG_INT_F77 F77_FUNC_(uq_log_int,UQ_LOG) 57 void UQ_PROD2_F77(
const double*,
const double*,
double*,
int*);
58 void UQ_DIV_F77(
const double*,
const double*,
double*,
int*);
59 void UQ_EXP_F77(
const double*,
double*,
int*,
int*,
double*,
int*);
60 void UQ_LOG_F77(
const double*,
double*,
int*,
int*,
double*,
int*);
61 void UQ_SQRT_F77(
const double*,
double*,
int*,
int*);
66 template <
typename ordinal_type,
typename value_type>
67 Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type, value_type>::
68 ForUQTKOrthogPolyExpansion(
71 EXPANSION_METHOD method_,
77 order = this->basis->order();
78 dim = this->basis->dimension();
84 template <
typename ordinal_type,
typename value_type>
86 Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type, value_type>::
90 OrthogPolyExpansionBase<ordinal_type, value_type, node_type>::timesEqual(c,
val);
93 template <
typename ordinal_type,
typename value_type>
95 Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type, value_type>::
99 OrthogPolyExpansionBase<ordinal_type, value_type, node_type>::divideEqual(c,
val);
102 template <
typename ordinal_type,
typename value_type>
104 Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type, value_type>::
116 TEUCHOS_TEST_FOR_EXCEPTION(sz < pc, std::logic_error,
117 "Stokhos::ForUQTKOrthogPolyExpansion::timesEqual()" <<
118 ": Expansion size (" << sz <<
119 ") is too small for computation.");
126 if (p > 1 && xp > 1) {
127 TEUCHOS_TEST_FOR_EXCEPTION(pc != xp, std::logic_error,
128 "Stokhos::ForUQTKOrthogPolyExpansion::timesEqual()" 129 <<
": Arguments have incompatible sizes: " 130 <<
"x.size() = " << xp <<
", c.size() = " << pc <<
".");
153 template <
typename ordinal_type,
typename value_type>
155 Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type, value_type>::
157 const OrthogPolyApprox<ordinal_type, value_type, node_type>&
x)
166 TEUCHOS_TEST_FOR_EXCEPTION(sz < pc, std::logic_error,
167 "Stokhos::ForUQTKOrthogPolyExpansion::divideEqual()" <<
168 ": Expansion size (" << sz <<
169 ") is too small for computation.");
177 TEUCHOS_TEST_FOR_EXCEPTION(pc != xp, std::logic_error,
178 "Stokhos::ForUQTKOrthogPolyExpansion::divideEqual()" 179 <<
": Arguments have incompatible sizes: " 180 <<
"x.size() = " << xp <<
", c.size() = " << pc <<
".");
195 template <
typename ordinal_type,
typename value_type>
197 Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type, value_type>::
205 if (pa > 1 && pb > 1)
209 TEUCHOS_TEST_FOR_EXCEPTION(sz < pc, std::logic_error,
210 "Stokhos::ForUQTKOrthogPolyExpansion::times()" <<
211 ": Expansion size (" << sz <<
212 ") is too small for computation.");
220 if (pa > 1 && pb > 1) {
221 TEUCHOS_TEST_FOR_EXCEPTION(pa != pc || pb != pc, std::logic_error,
222 "Stokhos::ForUQTKOrthogPolyExpansion::times()" 223 <<
": Arguments have incompatible sizes: " 224 <<
"a.size() = " << pa <<
", b.size() = " << pb
225 <<
", required size = " << pc <<
".");
243 template <
typename ordinal_type,
typename value_type>
245 Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type, value_type>::
250 OrthogPolyExpansionBase<ordinal_type, value_type, node_type>::times(c,a,b);
253 template <
typename ordinal_type,
typename value_type>
255 Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type, value_type>::
260 OrthogPolyExpansionBase<ordinal_type, value_type, node_type>::times(c,a,b);
263 template <
typename ordinal_type,
typename value_type>
265 Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type, value_type>::
277 TEUCHOS_TEST_FOR_EXCEPTION(sz < pc, std::logic_error,
278 "Stokhos::ForUQTKOrthogPolyExpansion::divide()" <<
279 ": Expansion size (" << sz <<
280 ") is too small for computation.");
289 TEUCHOS_TEST_FOR_EXCEPTION(pa != pc || pb != pc, std::logic_error,
290 "Stokhos::ForUQTKOrthogPolyExpansion::divide()" 291 <<
": Arguments have incompatible sizes: " 292 <<
"a.size() = " << pa <<
", b.size() = " << pb
293 <<
", required size = " << pc <<
".");
304 template <
typename ordinal_type,
typename value_type>
306 Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type, value_type>::
324 TEUCHOS_TEST_FOR_EXCEPTION(pb != pc, std::logic_error,
325 "Stokhos::ForUQTKOrthogPolyExpansion::divide()" 326 <<
": Arguments have incompatible sizes: " 327 <<
"b.size() = " << pb
328 <<
", required size = " << pc <<
".");
339 template <
typename ordinal_type,
typename value_type>
341 Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type, value_type>::
346 OrthogPolyExpansionBase<ordinal_type, value_type, node_type>::divide(c,a,b);
349 template <
typename ordinal_type,
typename value_type>
368 TEUCHOS_TEST_FOR_EXCEPTION(pa != pc, std::logic_error,
369 "Stokhos::ForUQTKOrthogPolyExpansion::exp()" 370 <<
": Arguments have incompatible sizes: " 371 <<
"a.size() = " << pa <<
", c.size() = " << pc
374 if (method == TAYLOR) {
385 template <
typename ordinal_type,
typename value_type>
404 TEUCHOS_TEST_FOR_EXCEPTION(pa != pc, std::logic_error,
405 "Stokhos::ForUQTKOrthogPolyExpansion::log()" 406 <<
": Arguments have incompatible sizes: " 407 <<
"a.size() = " << pa <<
", c.size() = " << pc
410 if (method == TAYLOR) {
421 template <
typename ordinal_type,
typename value_type>
438 template <
typename ordinal_type,
typename value_type>
457 TEUCHOS_TEST_FOR_EXCEPTION(pa != pc, std::logic_error,
458 "Stokhos::ForUQTKOrthogPolyExpansion::sqrt()" 459 <<
": Arguments have incompatible sizes: " 460 <<
"a.size() = " << pa <<
", c.size() = " << pc
470 template <
typename ordinal_type,
typename value_type>
488 template <
typename ordinal_type,
typename value_type>
507 template <
typename ordinal_type,
typename value_type>
525 template <
typename ordinal_type,
typename value_type>
544 template <
typename ordinal_type,
typename value_type>
556 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
557 "Stokhos::ForUQTKOrthogPolyExpansion::sin()" 558 <<
": Method not implemented!");
561 template <
typename ordinal_type,
typename value_type>
573 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
574 "Stokhos::ForUQTKOrthogPolyExpansion::cos()" 575 <<
": Method not implemented!");
578 template <
typename ordinal_type,
typename value_type>
590 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
591 "Stokhos::ForUQTKOrthogPolyExpansion::tan()" 592 <<
": Method not implemented!");
595 template <
typename ordinal_type,
typename value_type>
607 this->minusEqual(s, t);
617 template <
typename ordinal_type,
typename value_type>
629 this->plusEqual(c, t);
639 template <
typename ordinal_type,
typename value_type>
652 this->minus(t, c, s);
653 this->plusEqual(c, s);
663 template <
typename ordinal_type,
typename value_type>
675 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
676 "Stokhos::ForUQTKOrthogPolyExpansion::acos()" 677 <<
": Method not implemented!");
680 template <
typename ordinal_type,
typename value_type>
692 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
693 "Stokhos::ForUQTKOrthogPolyExpansion::asin()" 694 <<
": Method not implemented!");
697 template <
typename ordinal_type,
typename value_type>
709 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
710 "Stokhos::ForUQTKOrthogPolyExpansion::atan()" 711 <<
": Method not implemented!");
714 template <
typename ordinal_type,
typename value_type>
716 Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type, value_type>::
721 if (a.
size() == 1 && b.
size() == 1) {
724 c[0] = std::atan2(a[0], b[0]);
727 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
728 "Stokhos::ForUQTKOrthogPolyExpansion::atan2()" 729 <<
": Method not implemented!");
732 template <
typename ordinal_type,
typename value_type>
734 Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type, value_type>::
742 c[0] = std::atan2(a, b[0]);
745 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
746 "Stokhos::ForUQTKOrthogPolyExpansion::atan2()" 747 <<
": Method not implemented!");
750 template <
typename ordinal_type,
typename value_type>
752 Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type, value_type>::
760 c[0] = std::atan2(a[0], b);
763 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
764 "Stokhos::ForUQTKOrthogPolyExpansion::atan2()" 765 <<
": Method not implemented!");
768 template <
typename ordinal_type,
typename value_type>
780 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
781 "Stokhos::ForUQTKOrthogPolyExpansion::acosh()" 782 <<
": Method not implemented!");
785 template <
typename ordinal_type,
typename value_type>
797 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
798 "Stokhos::ForUQTKOrthogPolyExpansion::asinh()" 799 <<
": Method not implemented!");
802 template <
typename ordinal_type,
typename value_type>
814 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
815 "Stokhos::ForUQTKOrthogPolyExpansion::atanh()" 816 <<
": Method not implemented!");
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > tan(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > sinh(const PCE< Storage > &a)
void resize(ordinal_type sz)
Resize coefficient array (coefficients are preserved)
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
KOKKOS_INLINE_FUNCTION PCE< Storage > pow(const PCE< Storage > &a, const PCE< Storage > &b)
OrthogPoly< T, Storage > atanh(const OrthogPoly< T, Storage > &a)
pointer coeff()
Return coefficient array.
KOKKOS_INLINE_FUNCTION PCE< Storage > tanh(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > cbrt(const PCE< Storage > &a)
ordinal_type size() const
Return size.
static T * get_and_fill(int sz)
Get memory for new array of length sz and fill with zeros.
KOKKOS_INLINE_FUNCTION PCE< Storage > acos(const PCE< Storage > &a)
Abstract base class for multivariate orthogonal polynomials.
const IndexType const IndexType const IndexType const IndexType const ValueType const ValueType * x
OrthogPoly< T, Storage > acosh(const OrthogPoly< T, Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > cosh(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > atan(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > exp(const PCE< Storage > &a)
Class to store coefficients of a projection onto an orthogonal polynomial basis.
OrthogPoly< T, Storage > asinh(const OrthogPoly< T, Storage > &a)
static void copy(const T *src, T *dest, int sz)
Copy array from src to dest of length sz.
KOKKOS_INLINE_FUNCTION PCE< Storage > sin(const PCE< Storage > &a)
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)