本文整理汇总了C++中Epetra_Vector::MaxValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Epetra_Vector::MaxValue方法的具体用法?C++ Epetra_Vector::MaxValue怎么用?C++ Epetra_Vector::MaxValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Epetra_Vector
的用法示例。
在下文中一共展示了Epetra_Vector::MaxValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NormOne
//=============================================================================
double Epetra_MsrMatrix::NormOne() const {
if (NormOne_>-1.0) return(NormOne_);
if (!Filled()) EPETRA_CHK_ERR(-1); // Matrix must be filled.
Epetra_Vector * x = new Epetra_Vector(RowMatrixRowMap()); // Need temp vector for column sums
Epetra_Vector * xp = 0;
Epetra_Vector * x_tmp = 0;
// If we have a non-trivial importer, we must export elements that are permuted or belong to other processors
if (RowMatrixImporter()!=0) {
x_tmp = new Epetra_Vector(RowMatrixColMap()); // Create temporary import vector if needed
xp = x_tmp;
}
int i, j;
for (i=0; i < NumMyCols_; i++) (*xp)[i] = 0.0;
for (i=0; i < NumMyRows_; i++) {
int NumEntries = GetRow(i);
for (j=0; j < NumEntries; j++) (*xp)[Indices_[j]] += fabs(Values_[j]);
}
if (RowMatrixImporter()!=0) x->Export(*x_tmp, *RowMatrixImporter(), Add); // Fill x with Values from temp vector
x->MaxValue(&NormOne_); // Find max
if (x_tmp!=0) delete x_tmp;
delete x;
UpdateFlops(NumGlobalNonzeros());
return(NormOne_);
}