本文整理汇总了C++中TPZFMatrix::g方法的典型用法代码示例。如果您正苦于以下问题:C++ TPZFMatrix::g方法的具体用法?C++ TPZFMatrix::g怎么用?C++ TPZFMatrix::g使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPZFMatrix
的用法示例。
在下文中一共展示了TPZFMatrix::g方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Size
void TPZSkylMatrix<TVar>::MultAdd(const TPZFMatrix<TVar> &x,const TPZFMatrix<TVar> &y, TPZFMatrix<TVar> &z,
const TVar alpha,const TVar beta ,const int opt,const int stride ) const {
// Computes z = beta * y + alpha * opt(this)*x
// z and x cannot overlap in memory
if ((!opt && this->Cols()*stride != x.Rows()) || this->Rows()*stride != x.Rows())
TPZMatrix<TVar>::Error(__PRETTY_FUNCTION__," <matrixs with incompatible dimensions>" );
if(z.Rows() != x.Rows() || z.Cols() != x.Cols()) z.Redim(x.Rows(),x.Cols());
if(x.Cols() != y.Cols() || x.Cols() != z.Cols() || x.Rows() != y.Rows() || x.Rows() != z.Rows()) {
cout << "x.Cols = " << x.Cols() << " y.Cols()"<< y.Cols() << " z.Cols() " << z.Cols() << " x.Rows() " << x.Rows() << " y.Rows() "<< y.Rows() << " z.Rows() "<< z.Rows() << endl;
TPZMatrix<TVar>::Error(__PRETTY_FUNCTION__," incompatible dimensions\n");
}
this->PrepareZ(y,z,beta,opt,stride);
int rows = this->Rows();
int xcols = x.Cols();
int ic, r;
for (ic = 0; ic < xcols; ic++) {
for( r = 0 ; r < rows ; r++ ) {
int offset = Size(r);
TVar val = 0.;
const TVar *p = &x.g((r-offset+1)*stride,ic);
TVar *diag = fElem[r] + offset-1;
TVar *diaglast = fElem[r];
while( diag > diaglast ) {
val += *diag-- * *p;
p += stride;
}
if( diag == diaglast ) val += *diag * *p;
z(r*stride,ic) += val*alpha;
TVar *zp = &z((r-offset+1)*stride,ic);
val = x.g(r*stride,ic);
diag = fElem[r] + offset-1;
while( diag > diaglast ) {
*zp += alpha * *diag-- * val;
zp += stride;
}
}
}
}