本文整理汇总了C++中stokhos::OrthogPolyApprox::size方法的典型用法代码示例。如果您正苦于以下问题:C++ OrthogPolyApprox::size方法的具体用法?C++ OrthogPolyApprox::size怎么用?C++ OrthogPolyApprox::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stokhos::OrthogPolyApprox
的用法示例。
在下文中一共展示了OrthogPolyApprox::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
Stokhos::ConstantOrthogPolyExpansion<ordinal_type, value_type>::
asin(Stokhos::OrthogPolyApprox<ordinal_type, value_type>& c,
const Stokhos::OrthogPolyApprox<ordinal_type, value_type>& a)
{
if (c.size() < 1)
c.resize(1);
c[0] = std::asin(a[0]);
}
示例2:
void
Stokhos::ConstantOrthogPolyExpansion<ordinal_type, value_type>::
divide(Stokhos::OrthogPolyApprox<ordinal_type, value_type, node_type>& c,
const value_type& a,
const Stokhos::OrthogPolyApprox<ordinal_type, value_type, node_type>& b)
{
if (c.size() < 1)
c.resize(1);
c[0] = a / b[0];
}
示例3:
void
Stokhos::QuadOrthogPolyExpansion<ordinal_type, value_type>::
divideEqual(Stokhos::OrthogPolyApprox<ordinal_type, value_type>& c,
const value_type& val)
{
ordinal_type pc = c.size();
value_type* cc = c.coeff();
for (ordinal_type i=0; i<pc; i++)
cc[i] /= val;
}
示例4: index
void
Stokhos::CGDivisionExpansionStrategy<ordinal_type,value_type,node_type>::
divide(Stokhos::OrthogPolyApprox<ordinal_type, value_type, node_type>& c,
const value_type& alpha,
const Stokhos::OrthogPolyApprox<ordinal_type, value_type, node_type>& a,
const Stokhos::OrthogPolyApprox<ordinal_type, value_type, node_type>& b,
const value_type& beta)
{
#ifdef STOKHOS_TEUCHOS_TIME_MONITOR
TEUCHOS_FUNC_TIME_MONITOR("Stokhos::CGDivisionStrategy::divide()");
#endif
ordinal_type sz = basis->size();
ordinal_type pa = a.size();
ordinal_type pb = b.size();
ordinal_type pc;
if (pb > 1)
pc = sz;
else
pc = pa;
if (c.size() != pc)
c.resize(pc);
const value_type* ca = a.coeff();
const value_type* cb = b.coeff();
value_type* cc = c.coeff();
if (pb > 1) {
// Compute A
A->putScalar(0.0);
typename Cijk_type::k_iterator k_begin = Cijk->k_begin();
typename Cijk_type::k_iterator k_end = Cijk->k_end();
if (pb < Cijk->num_k())
k_end = Cijk->find_k(pb);
value_type cijk;
ordinal_type i,j,k;
for (typename Cijk_type::k_iterator k_it=k_begin; k_it!=k_end; ++k_it) {
k = index(k_it);
for (typename Cijk_type::kj_iterator j_it = Cijk->j_begin(k_it);
j_it != Cijk->j_end(k_it); ++j_it) {
j = index(j_it);
for (typename Cijk_type::kji_iterator i_it = Cijk->i_begin(j_it);
i_it != Cijk->i_end(j_it); ++i_it) {
i = index(i_it);
cijk = value(i_it);
(*A)(i,j) += cijk*cb[k];
}
}
}
// Compute B
B->putScalar(0.0);
for (ordinal_type i=0; i<pa; i++)
(*B)(i,0) = ca[i]*basis->norm_squared(i);
Teuchos::SerialDenseMatrix<ordinal_type,value_type> D(sz, 1);
//Equilibrate the linear system
if (equil == 1){
//Create diag mtx of max row entries
for (ordinal_type i=0; i<sz; i++){
Teuchos::SerialDenseMatrix<ordinal_type, value_type> r(Teuchos::View, *A, 1, sz, i, 0);
D(i,0)=sqrt(r.normOne());
}
//Compute inv(D)*A*inv(D)
for (ordinal_type i=0; i<sz; i++){
for (ordinal_type j=0; j<sz; j++){
(*A)(i,j)=(*A)(i,j)/(D(i,0)*D(j,0));
}
}
//Scale b by inv(D)
for (ordinal_type i=0; i<sz; i++){
(*B)(i,0)=(*B)(i,0)/D(i,0);
}
}
if (linear == 1){
//Compute M, the linear matrix to be used in the preconditioner
pb = basis->dimension()+1;
M->putScalar(0.0);
if (pb < Cijk->num_k())
k_end = Cijk->find_k(pb);
for (typename Cijk_type::k_iterator k_it=k_begin; k_it!=k_end; ++k_it) {
k = index(k_it);
for ( typename Cijk_type::kj_iterator j_it = Cijk->j_begin(k_it);
j_it != Cijk->j_end(k_it); ++j_it) {
j = index(j_it);
for ( typename Cijk_type::kji_iterator i_it = Cijk->i_begin(j_it);
i_it != Cijk->i_end(j_it); ++i_it) {
i = index(i_it);
//.........这里部分代码省略.........