51 template <
typename ordinal_type,
typename value_type,
typename node_type>
66 std::string name =
params->
get(
"Division Strategy",
"Dense Direct");
67 double tol =
params->
get(
"Division Tolerance", 1e-6);
68 int prec_iter =
params->
get(
"prec_iter", 1);
69 int max_it =
params->
get(
"max_it_div", 50);
70 std::string prec =
params->
get(
"Prec Strategy",
"None");
74 else if (prec ==
"Diag")
76 else if (prec ==
"Jacobi")
78 else if (prec ==
"GS")
80 else if (prec ==
"Schur")
84 std::string linopt =
params->
get(
"Prec option",
"whole");
86 if (linopt ==
"linear")
89 std::string schuropt =
params->
get(
"Schur option",
"diag");
91 if (schuropt ==
"full")
94 int equil =
params->
get(
"Equilibrate", 0);
97 if (name ==
"Dense Direct")
100 else if (name ==
"SPD Dense Direct")
103 else if (name ==
"Mean-Based")
106 else if (name ==
"GMRES")
108 Teuchos::rcp(
new GMRESDivisionExpansionStrategy<ordinal_type,value_type,node_type>(this->
basis, this->
Cijk, prec_iter, tol, PrecNum, max_it, linear, diag, equil));
109 else if (name ==
"CG")
111 Teuchos::rcp(
new CGDivisionExpansionStrategy<ordinal_type,value_type,node_type>(this->
basis, this->
Cijk, prec_iter, tol, PrecNum, max_it, linear, diag, equil));
118 template <
typename ordinal_type,
typename value_type,
typename node_type>
125 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
140 template <
typename ordinal_type,
typename value_type,
typename node_type>
149 template <
typename ordinal_type,
typename value_type,
typename node_type>
158 template <
typename ordinal_type,
typename value_type,
typename node_type>
164 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
173 template <
typename ordinal_type,
typename value_type,
typename node_type>
179 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
188 template <
typename ordinal_type,
typename value_type,
typename node_type>
195 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
208 template <
typename ordinal_type,
typename value_type,
typename node_type>
215 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
228 template <
typename ordinal_type,
typename value_type,
typename node_type>
235 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
246 "Stokhos::OrthogPolyExpansionBase::timesEqual()" <<
247 ": Expansion size (" << sz <<
248 ") is too small for computation.");
255 if (p > 1 && xp > 1) {
261 if (pc < Cijk->num_i())
262 i_end = Cijk->find_i(pc);
280 k_it != Cijk->k_end(i_it); ++k_it) {
284 j_it != Cijk->j_end(k_it); ++j_it) {
288 tmp += cijk*kc[k]*jc[
j];
292 cc[i] = tmp / basis->norm_squared(i);
311 template <
typename ordinal_type,
typename value_type,
typename node_type>
318 division_strategy->divide(c, 1.0, c, x, 0.0);
321 template <
typename ordinal_type,
typename value_type,
typename node_type>
328 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
343 cc[i] = ca[i] + cb[i];
349 cc[i] = ca[i] + cb[i];
355 template <
typename ordinal_type,
typename value_type,
typename node_type>
362 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
377 template <
typename ordinal_type,
typename value_type,
typename node_type>
384 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
399 template <
typename ordinal_type,
typename value_type,
typename node_type>
406 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
421 cc[i] = ca[i] - cb[i];
427 cc[i] = ca[i] - cb[i];
433 template <
typename ordinal_type,
typename value_type,
typename node_type>
440 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
455 template <
typename ordinal_type,
typename value_type,
typename node_type>
462 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
477 template <
typename ordinal_type,
typename value_type,
typename node_type>
484 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
490 if (pa > 1 && pb > 1)
495 "Stokhos::OrthogPolyExpansionBase::times()" <<
496 ": Expansion size (" << sz <<
497 ") is too small for computation.");
505 if (pa > 1 && pb > 1) {
508 if (pc < Cijk->num_i())
509 i_end = Cijk->find_i(pc);
526 k_it != Cijk->k_end(i_it); ++k_it) {
530 j_it != Cijk->j_end(k_it); ++j_it) {
534 tmp += cijk*kc[k]*jc[
j];
538 cc[i] = tmp / basis->norm_squared(i);
554 template <
typename ordinal_type,
typename value_type,
typename node_type>
561 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
575 template <
typename ordinal_type,
typename value_type,
typename node_type>
582 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
596 template <
typename ordinal_type,
typename value_type,
typename node_type>
603 division_strategy->divide(c, 1.0, a, b, 0.0);
606 template <
typename ordinal_type,
typename value_type,
typename node_type>
614 division_strategy->divide(c, 1.0, aa, b, 0.0);
617 template <
typename ordinal_type,
typename value_type,
typename node_type>
624 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
638 template <
typename ordinal_type,
typename value_type,
typename node_type>
644 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
651 template <
typename ordinal_type,
typename value_type,
typename node_type>
657 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
664 template <
typename ordinal_type,
typename value_type,
typename node_type>
671 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
680 template <
typename ordinal_type,
typename value_type,
typename node_type>
687 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
698 template <
typename ordinal_type,
typename value_type,
typename node_type>
705 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
716 template <
typename ordinal_type,
typename value_type,
typename node_type>
723 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
732 template <
typename ordinal_type,
typename value_type,
typename node_type>
739 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
750 template <
typename ordinal_type,
typename value_type,
typename node_type>
757 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
void divideEqual(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const value_type &x)
Teuchos::RCP< const OrthogPolyBasis< ordinal_type, value_type > > basis
Basis.
#define TEUCHOS_FUNC_TIME_MONITOR(FUNCNAME)
Teuchos::RCP< Teuchos::ParameterList > params
Parameter list.
void resize(ordinal_type sz)
Resize coefficient array (coefficients are preserved)
void minusEqual(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const value_type &x)
Strategy interface for computing PCE of a/b using only b[0].
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
T & get(ParameterList &l, const std::string &name)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void init(const value_type &v)
Initialize coefficients to value.
void divide(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)
Teuchos::RCP< Stokhos::DivisionExpansionStrategy< ordinal_type, value_type, node_type > > division_strategy
Division expansion strategy.
static void destroy_and_release(T *m, int sz)
Destroy array elements and release memory.
void timesEqual(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const value_type &x)
void max(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)
pointer coeff()
Return coefficient array.
value_type two_norm() const
Compute the two-norm of expansion.
void plusEqual(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const value_type &x)
static T * get_and_fill(int sz)
Get memory for new array of length sz and fill with zeros.
Bi-directional iterator for traversing a sparse array.
Abstract base class for multivariate orthogonal polynomials.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void min(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)
Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > basis() const
Return basis.
void plus(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)
void minus(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)
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)
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< is_view_uq_pce< view_type >::value, typename CijkType< view_type >::type >::type cijk(const view_type &view)
Strategy interface for computing PCE of a/b using only b[0].
Class to store coefficients of a projection onto an orthogonal polynomial basis.
void abs(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
ordinal_type size() const
Return size.
Strategy interface for computing PCE of a/b using only b[0].
Teuchos::RCP< const Stokhos::Sparse3Tensor< ordinal_type, value_type > > Cijk
Triple-product tensor.
Strategy interface for computing PCE of a/b using only b[0].
void unaryMinus(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
void fabs(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
Strategy interface for computing PCE of a/b using only b[0].
OrthogPolyExpansionBase(const Teuchos::RCP< const OrthogPolyBasis< ordinal_type, value_type > > &basis, const Teuchos::RCP< const Stokhos::Sparse3Tensor< ordinal_type, value_type > > &Cijk, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Constructor.