本文整理汇总了C++中Epetra_SerialDenseMatrix::SetFlopCounter方法的典型用法代码示例。如果您正苦于以下问题:C++ Epetra_SerialDenseMatrix::SetFlopCounter方法的具体用法?C++ Epetra_SerialDenseMatrix::SetFlopCounter怎么用?C++ Epetra_SerialDenseMatrix::SetFlopCounter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Epetra_SerialDenseMatrix
的用法示例。
在下文中一共展示了Epetra_SerialDenseMatrix::SetFlopCounter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
N = 2000;
NRHS = 5;
LDA = N;
LDB = N;
LDX = N;
if (verbose) cout << "\n\nComputing factor of an " << N << " x " << N << " general matrix...Please wait.\n\n" << endl;
// Define A and X
A = new double[LDA*N];
X = new double[LDB*NRHS];
for (j=0; j<N; j++) {
for (k=0; k<NRHS; k++) X[j+k*LDX] = 1.0/((double) (j+5+k));
for (i=0; i<N; i++) {
if (i==((j+2)%N)) A[i+j*LDA] = 100.0 + i;
else A[i+j*LDA] = -11.0/((double) (i+5)*(j+2));
}
}
// Define Epetra_SerialDenseMatrix object
Epetra_SerialDenseMatrix BigMatrix(Copy, A, LDA, N, N);
Epetra_SerialDenseMatrix OrigBigMatrix(View, A, LDA, N, N);
Epetra_SerialDenseSolver BigSolver;
BigSolver.FactorWithEquilibration(true);
BigSolver.SetMatrix(BigMatrix);
// Time factorization
Epetra_Flops counter;
BigSolver.SetFlopCounter(counter);
Epetra_Time Timer(Comm);
double tstart = Timer.ElapsedTime();
ierr = BigSolver.Factor();
if (ierr!=0 && verbose) cout << "Error in factorization = "<<ierr<< endl;
assert(ierr==0);
double time = Timer.ElapsedTime() - tstart;
double FLOPS = counter.Flops();
double MFLOPS = FLOPS/time/1000000.0;
if (verbose) cout << "MFLOPS for Factorization = " << MFLOPS << endl;
// Define Left hand side and right hand side
Epetra_SerialDenseMatrix LHS(View, X, LDX, N, NRHS);
Epetra_SerialDenseMatrix RHS;
RHS.Shape(N,NRHS); // Allocate RHS
// Compute RHS from A and X
Epetra_Flops RHS_counter;
RHS.SetFlopCounter(RHS_counter);
tstart = Timer.ElapsedTime();
RHS.Multiply('N', 'N', 1.0, OrigBigMatrix, LHS, 0.0);
time = Timer.ElapsedTime() - tstart;
Epetra_SerialDenseMatrix OrigRHS = RHS;
FLOPS = RHS_counter.Flops();
MFLOPS = FLOPS/time/1000000.0;
if (verbose) cout << "MFLOPS to build RHS (NRHS = " << NRHS <<") = " << MFLOPS << endl;
// Set LHS and RHS and solve
BigSolver.SetVectors(LHS, RHS);