本文整理汇总了C++中Epetra_Vector::NormInf方法的典型用法代码示例。如果您正苦于以下问题:C++ Epetra_Vector::NormInf方法的具体用法?C++ Epetra_Vector::NormInf怎么用?C++ Epetra_Vector::NormInf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Epetra_Vector
的用法示例。
在下文中一共展示了Epetra_Vector::NormInf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ComputeNorm
double AztecOO_StatusTestResNorm::ComputeNorm(const Epetra_Vector & vec, NormType typeofnorm) {
double result = 0.0;
if (typeofnorm==TwoNorm) vec.Norm2(&result);
else if (typeofnorm==OneNorm) vec.Norm1(&result);
else vec.NormInf(&result);
return(result);
}
示例2: DestroyPreconditioner
//.........这里部分代码省略.........
for (int istep = 0 ; istep < NumAdaptiveVectors ; ++istep) {
if (verbose_) {
std::cout << PrintMsg_ << "\tAdaptation step " << istep << std::endl;
std::cout << PrintMsg_ << "\t---------------" << std::endl;
}
// ==================== //
// look for "bad" modes //
// ==================== //
// note: should an error occur, ML_CHK_ERR will return,
// and LHS and RHS will *not* be delete'd (--> memory leak).
// Anyway, this means that something wrong happened in the code
// and should be fixed by the user.
LHS->Random();
double Norm2;
for (int i = 0 ; i < MaxSweeps ; ++i) {
// RHS = (I - ML^{-1} A) LHS
ML_CHK_ERR(RowMatrix_->Multiply(false,*LHS,*RHS));
// FIXME: can do something slightly better here
ML_CHK_ERR(ApplyInverse(*RHS,*RHS));
ML_CHK_ERR(LHS->Update(-1.0,*RHS,1.0));
LHS->Norm2(&Norm2);
if (verbose_) {
std::cout << PrintMsg_ << "\titer " << i << ", ||x||_2 = ";
std::cout << Norm2 << std::endl;
}
}
// scaling vectors
double NormInf;
LHS->NormInf(&NormInf);
LHS->Scale(1.0 / NormInf);
// ========================================================= //
// copy tentative and computed null space into NewNullSpace, //
// which now becomes the standard null space //
// ========================================================= //
int NewNullSpaceSize = OldNullSpaceSize + 1;
NewNullSpace = new double[NumMyRows() * NewNullSpaceSize];
assert (NewNullSpace != 0);
int itmp = OldNullSpaceSize * NumMyRows();
for (int i = 0 ; i < itmp ; ++i) {
NewNullSpace[i] = OldNullSpace[i];
}
for (int j = 0 ; j < NumMyRows() ; ++j) {
NewNullSpace[itmp + j] = (*LHS)[j];
}
// =============== //
// visualize modes //
// =============== //
if (List_.get("adaptive: visualize", false)) {
double* x_coord = List_.get("viz: x-coordinates", (double*)0);
double* y_coord = List_.get("viz: y-coordinates", (double*)0);
double* z_coord = List_.get("viz: z-coordinates", (double*)0);
assert (x_coord != 0);
std::vector<double> plot_me(NumMyRows()/NumPDEEqns_);
示例3: main
//.........这里部分代码省略.........
Epetra_Vector tmp1(*readMap);
Epetra_Vector tmp2(map);
readA->Multiply(false, *readxexact, tmp1);
A.Multiply(false, xexact, tmp2);
double residual;
tmp1.Norm2(&residual);
if (verbose) cout << "Norm of Ax from file = " << residual << endl;
tmp2.Norm2(&residual);
if (verbose) cout << "Norm of Ax after redistribution = " << residual << endl << endl << endl;
//cout << "A from file = " << *readA << endl << endl << endl;
//cout << "A after dist = " << A << endl << endl << endl;
delete readA;
delete readx;
delete readb;
delete readxexact;
delete readMap;
Comm.Barrier();
bool smallProblem = false;
if (A.RowMap().NumGlobalElements()<100) smallProblem = true;
if (smallProblem)
cout << "Original Matrix = " << endl << A << endl;
x.PutScalar(0.0);
Epetra_LinearProblem FullProblem(&A, &x, &b);
double normb, norma;
b.NormInf(&normb);
norma = A.NormInf();
if (verbose)
cout << "Inf norm of Original Matrix = " << norma << endl
<< "Inf norm of Original RHS = " << normb << endl;
Epetra_Time ReductionTimer(Comm);
Epetra_CrsSingletonFilter SingletonFilter;
Comm.Barrier();
double reduceInitTime = ReductionTimer.ElapsedTime();
SingletonFilter.Analyze(&A);
Comm.Barrier();
double reduceAnalyzeTime = ReductionTimer.ElapsedTime() - reduceInitTime;
if (SingletonFilter.SingletonsDetected())
cout << "Singletons found" << endl;
else {
cout << "Singletons not found" << endl;
exit(1);
}
SingletonFilter.ConstructReducedProblem(&FullProblem);
Comm.Barrier();
double reduceConstructTime = ReductionTimer.ElapsedTime() - reduceInitTime;
double totalReduceTime = ReductionTimer.ElapsedTime();
if (verbose)
cout << "\n\n****************************************************" << endl
<< " Reduction init time (sec) = " << reduceInitTime<< endl
<< " Reduction Analyze time (sec) = " << reduceAnalyzeTime << endl
<< " Construct Reduced Problem time (sec) = " << reduceConstructTime << endl
<< " Reduction Total time (sec) = " << totalReduceTime << endl<< endl;