19 template <
typename ordinal_type,
typename value_type,
typename node_type>
34 std::string name =
params->
get(
"Division Strategy",
"Dense Direct");
35 double tol =
params->
get(
"Division Tolerance", 1e-6);
36 int prec_iter =
params->
get(
"prec_iter", 1);
37 int max_it =
params->
get(
"max_it_div", 50);
38 std::string prec =
params->
get(
"Prec Strategy",
"None");
42 else if (prec ==
"Diag")
44 else if (prec ==
"Jacobi")
46 else if (prec ==
"GS")
48 else if (prec ==
"Schur")
52 std::string linopt =
params->
get(
"Prec option",
"whole");
54 if (linopt ==
"linear")
57 std::string schuropt =
params->
get(
"Schur option",
"diag");
59 if (schuropt ==
"full")
62 int equil =
params->
get(
"Equilibrate", 0);
65 if (name ==
"Dense Direct")
68 else if (name ==
"SPD Dense Direct")
71 else if (name ==
"Mean-Based")
74 else if (name ==
"GMRES")
76 Teuchos::rcp(
new GMRESDivisionExpansionStrategy<ordinal_type,value_type,node_type>(this->
basis, this->
Cijk, prec_iter, tol, PrecNum, max_it, linear, diag, equil));
77 else if (name ==
"CG")
79 Teuchos::rcp(
new CGDivisionExpansionStrategy<ordinal_type,value_type,node_type>(this->
basis, this->
Cijk, prec_iter, tol, PrecNum, max_it, linear, diag, equil));
86 template <
typename ordinal_type,
typename value_type,
typename node_type>
93 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
108 template <
typename ordinal_type,
typename value_type,
typename node_type>
117 template <
typename ordinal_type,
typename value_type,
typename node_type>
126 template <
typename ordinal_type,
typename value_type,
typename node_type>
132 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
141 template <
typename ordinal_type,
typename value_type,
typename node_type>
147 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
156 template <
typename ordinal_type,
typename value_type,
typename node_type>
163 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
176 template <
typename ordinal_type,
typename value_type,
typename node_type>
183 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
196 template <
typename ordinal_type,
typename value_type,
typename node_type>
203 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
214 "Stokhos::OrthogPolyExpansionBase::timesEqual()" <<
215 ": Expansion size (" << sz <<
216 ") is too small for computation.");
223 if (p > 1 && xp > 1) {
229 if (pc < Cijk->num_i())
230 i_end = Cijk->find_i(pc);
248 k_it != Cijk->k_end(i_it); ++k_it) {
252 j_it != Cijk->j_end(k_it); ++j_it) {
256 tmp += cijk*kc[k]*jc[
j];
260 cc[i] = tmp / basis->norm_squared(i);
279 template <
typename ordinal_type,
typename value_type,
typename node_type>
286 division_strategy->divide(c, 1.0, c, x, 0.0);
289 template <
typename ordinal_type,
typename value_type,
typename node_type>
296 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
311 cc[i] = ca[i] + cb[i];
317 cc[i] = ca[i] + cb[i];
323 template <
typename ordinal_type,
typename value_type,
typename node_type>
330 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
345 template <
typename ordinal_type,
typename value_type,
typename node_type>
352 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
367 template <
typename ordinal_type,
typename value_type,
typename node_type>
374 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
389 cc[i] = ca[i] - cb[i];
395 cc[i] = ca[i] - cb[i];
401 template <
typename ordinal_type,
typename value_type,
typename node_type>
408 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
423 template <
typename ordinal_type,
typename value_type,
typename node_type>
430 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
445 template <
typename ordinal_type,
typename value_type,
typename node_type>
452 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
458 if (pa > 1 && pb > 1)
463 "Stokhos::OrthogPolyExpansionBase::times()" <<
464 ": Expansion size (" << sz <<
465 ") is too small for computation.");
473 if (pa > 1 && pb > 1) {
476 if (pc < Cijk->num_i())
477 i_end = Cijk->find_i(pc);
494 k_it != Cijk->k_end(i_it); ++k_it) {
498 j_it != Cijk->j_end(k_it); ++j_it) {
502 tmp += cijk*kc[k]*jc[
j];
506 cc[i] = tmp / basis->norm_squared(i);
522 template <
typename ordinal_type,
typename value_type,
typename node_type>
529 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
543 template <
typename ordinal_type,
typename value_type,
typename node_type>
550 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
564 template <
typename ordinal_type,
typename value_type,
typename node_type>
571 division_strategy->divide(c, 1.0, a, b, 0.0);
574 template <
typename ordinal_type,
typename value_type,
typename node_type>
582 division_strategy->divide(c, 1.0, aa, b, 0.0);
585 template <
typename ordinal_type,
typename value_type,
typename node_type>
592 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
606 template <
typename ordinal_type,
typename value_type,
typename node_type>
612 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
619 template <
typename ordinal_type,
typename value_type,
typename node_type>
625 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
632 template <
typename ordinal_type,
typename value_type,
typename node_type>
639 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
648 template <
typename ordinal_type,
typename value_type,
typename node_type>
655 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
666 template <
typename ordinal_type,
typename value_type,
typename node_type>
673 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
684 template <
typename ordinal_type,
typename value_type,
typename node_type>
691 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
700 template <
typename ordinal_type,
typename value_type,
typename node_type>
707 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
718 template <
typename ordinal_type,
typename value_type,
typename node_type>
725 #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.