本文整理汇总了C++中ParameterList::unused方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterList::unused方法的具体用法?C++ ParameterList::unused怎么用?C++ ParameterList::unused使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterList
的用法示例。
在下文中一共展示了ParameterList::unused方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
MagnitudeType tol = tolCG * 10.0;
// Create a sort manager to pass into the block Krylov-Schur solver manager
// --> Make sure the reference-counted pointer is of type Anasazi::SortManager<>
// --> The block Krylov-Schur solver manager uses Anasazi::BasicSort<> by default,
// so you can also pass in the parameter "Which", instead of a sort manager.
RCP<Anasazi::SortManager<MagnitudeType> > MySort =
rcp( new Anasazi::BasicSort<MagnitudeType>( which ) );
//
// Create parameter list to pass into the solver manager
ParameterList MyPL;
MyPL.set( "Verbosity", verbosity );
MyPL.set( "Sort Manager", MySort );
//MyPL.set( "Which", which );
MyPL.set( "Block Size", blockSize );
MyPL.set( "Num Blocks", numBlocks );
MyPL.set( "Maximum Restarts", maxRestarts );
MyPL.set( "Step Size", stepSize );
MyPL.set( "Convergence Tolerance", tol );
MyPL.set( "In Situ Restarting", insitu );
//
// Create the solver manager
Anasazi::BlockKrylovSchurSolMgr<ScalarType,MV,OP> MySolverMgr(problem, MyPL);
//
// Check that the parameters were all consumed
if (MyPL.getEntryPtr("Verbosity")->isUsed() == false ||
MyPL.getEntryPtr("Block Size")->isUsed() == false ||
MyPL.getEntryPtr("Num Blocks")->isUsed() == false ||
MyPL.getEntryPtr("Maximum Restarts")->isUsed() == false ||
MyPL.getEntryPtr("Step Size")->isUsed() == false ||
MyPL.getEntryPtr("In Situ Restarting")->isUsed() == false ||
MyPL.getEntryPtr("Convergence Tolerance")->isUsed() == false) {
if (verbose && MyPID==0) {
cout << "Failure! Unused parameters: " << endl;
MyPL.unused(cout);
}
}
// Solve the problem to the specified tolerances or length
Anasazi::ReturnType returnCode = MySolverMgr.solve();
testFailed = false;
if (returnCode != Anasazi::Converged && shortrun==false) {
testFailed = true;
}
// Get the eigenvalues and eigenvectors from the eigenproblem
Anasazi::Eigensolution<ScalarType,MV> sol = problem->getSolution();
std::vector<Anasazi::Value<ScalarType> > evals = sol.Evals;
RCP<MV> evecs = sol.Evecs;
int numev = sol.numVecs;
if (numev > 0) {
std::ostringstream os;
os.setf(std::ios::scientific, std::ios::floatfield);
os.precision(6);
// Compute the direct residual
std::vector<ScalarType> normV( numev );
SerialDenseMatrix<int,ScalarType> T(numev,numev);
for (int i=0; i<numev; i++) {
T(i,i) = evals[i].realpart;
}
RCP<OP> KOp = rcp( new Anasazi::EpetraOp( K ));
RCP<OP> MOp = rcp( new Anasazi::EpetraOp( M ));
示例2: main
//.........这里部分代码省略.........
if (verbose) {
verbosity += Anasazi::FinalSummary + Anasazi::TimingDetails;
}
if (debug) {
verbosity += Anasazi::Debug;
}
// Eigensolver parameters
int maxIters = 450;
MagnitudeType tol = 1.0e-6;
//
// Create parameter list to pass into the solver manager
ParameterList MyPL;
MyPL.set( "Verbosity", verbosity );
MyPL.set( "Which", which );
MyPL.set( "Block Size", blockSize );
MyPL.set( "Maximum Iterations", maxIters );
MyPL.set( "Convergence Tolerance", tol );
MyPL.set( "Skinny Solver", skinny);
//
// Create the solver manager
Anasazi::RTRSolMgr<ScalarType,MV,OP> MySolverMan(problem, MyPL);
//
// Check that the parameters were all consumed
if (MyPL.getEntryPtr("Verbosity")->isUsed() == false ||
MyPL.getEntryPtr("Which")->isUsed() == false ||
MyPL.getEntryPtr("Block Size")->isUsed() == false ||
MyPL.getEntryPtr("Maximum Iterations")->isUsed() == false ||
MyPL.getEntryPtr("Convergence Tolerance")->isUsed() == false ||
MyPL.getEntryPtr("Skinny Solver")->isUsed() == false) {
if (verbose && MyPID==0) {
cout << "Failure! Unused parameters: " << endl;
MyPL.unused(cout);
}
}
// Solve the problem to the specified tolerances or length
Anasazi::ReturnType returnCode = MySolverMan.solve();
if (returnCode != Anasazi::Converged) {
testFailed = true;
}
// Get the eigenvalues and eigenvectors from the eigenproblem
Anasazi::Eigensolution<ScalarType,MV> sol = problem->getSolution();
std::vector<Anasazi::Value<ScalarType> > evals = sol.Evals;
RCP<MV> evecs = sol.Evecs;
int numev = sol.numVecs;
if (numev > 0) {
std::ostringstream os;
os.setf(std::ios::scientific, std::ios::floatfield);
os.precision(6);
// Compute the direct residual
std::vector<ScalarType> normV( numev );
SerialDenseMatrix<int,ScalarType> T(numev,numev);
for (int i=0; i<numev; i++) {
T(i,i) = evals[i].realpart;
}
RCP<MV> Mvecs = MVT::Clone( *evecs, numev ),
Kvecs = MVT::Clone( *evecs, numev );
OPT::Apply( *thyra_K, *evecs, *Kvecs );
OPT::Apply( *thyra_M, *evecs, *Mvecs );
示例3: main
//.........这里部分代码省略.........
}
else {
maxRestarts = 100;
}
MagnitudeType tol = 1.0e-6;
//
// Create parameter list to pass into the solver manager
ParameterList MyPL;
MyPL.set( "Verbosity", verbosity );
MyPL.set( "Which", which );
MyPL.set( "Block Size", blockSize );
MyPL.set( "Num Blocks", numBlocks );
MyPL.set( "Maximum Restarts", maxRestarts );
MyPL.set( "Convergence Tolerance", tol );
MyPL.set( "Use Locking", locking );
MyPL.set( "Locking Tolerance", tol/10 );
MyPL.set( "In Situ Restarting", insitu );
//
// Create the solver manager
Anasazi::BlockDavidsonSolMgr<ScalarType,MV,OP> MySolverMan(problem, MyPL);
//
// Check that the parameters were all consumed
if (MyPL.getEntryPtr("Verbosity")->isUsed() == false ||
MyPL.getEntryPtr("Which")->isUsed() == false ||
MyPL.getEntryPtr("Block Size")->isUsed() == false ||
MyPL.getEntryPtr("Num Blocks")->isUsed() == false ||
MyPL.getEntryPtr("Maximum Restarts")->isUsed() == false ||
MyPL.getEntryPtr("Convergence Tolerance")->isUsed() == false ||
MyPL.getEntryPtr("Use Locking")->isUsed() == false ||
MyPL.getEntryPtr("In Situ Restarting")->isUsed() == false ||
MyPL.getEntryPtr("Locking Tolerance")->isUsed() == false) {
if (verbose && MyPID==0) {
cout << "Failure! Unused parameters: " << endl;
MyPL.unused(cout);
}
}
// Solve the problem to the specified tolerances or length
Anasazi::ReturnType returnCode = MySolverMan.solve();
testFailed = false;
if (returnCode != Anasazi::Converged && shortrun==false) {
testFailed = true;
}
// Get the eigenvalues and eigenvectors from the eigenproblem
Anasazi::Eigensolution<ScalarType,MV> sol = problem->getSolution();
RCP<MV> evecs = sol.Evecs;
int numev = sol.numVecs;
if (numev > 0) {
std::ostringstream os;
os.setf(std::ios::scientific, std::ios::floatfield);
os.precision(6);
// Compute the direct residual
std::vector<MagnitudeType> normV( numev );
SerialDenseMatrix<int,ScalarType> T(numev,numev);
for (int i=0; i<numev; i++) {
T(i,i) = sol.Evals[i].realpart;
}
RCP<MV> Kvecs = MVT::Clone( *evecs, numev );
OPT::Apply( *K, *evecs, *Kvecs );
MVT::MvTimesMatAddMv( -ONE, *evecs, T, ONE, *Kvecs );
示例4: main
//.........这里部分代码省略.........
verbosity += Anasazi::FinalSummary + Anasazi::TimingDetails;
}
if (debug) {
verbosity += Anasazi::Debug;
}
// Eigensolver parameters
int maxRestarts = 25;
int maxDim = 50;
MagnitudeType tol = 1e-6;
//
// Create parameter list to pass into the solver manager
ParameterList MyPL;
MyPL.set( "Verbosity", verbosity );
MyPL.set( "Which", which );
MyPL.set( "Maximum Subspace Dimension", maxDim );
MyPL.set( "Block Size", blockSize );
MyPL.set( "Maximum Restarts", maxRestarts );
MyPL.set( "Convergence Tolerance", tol );
//
// Create the solver manager
Anasazi::GeneralizedDavidsonSolMgr<ScalarType,MV,OP> MySolverMgr(problem, MyPL);
//
// Check that the parameters were all consumed
if (MyPL.getEntryPtr("Verbosity")->isUsed() == false ||
MyPL.getEntryPtr("Which")->isUsed() == false ||
MyPL.getEntryPtr("Maximum Subspace Dimension")->isUsed() == false ||
MyPL.getEntryPtr("Block Size")->isUsed() == false ||
MyPL.getEntryPtr("Maximum Restarts")->isUsed() == false ||
MyPL.getEntryPtr("Convergence Tolerance")->isUsed() == false) {
if (verbose && MyPID==0) {
std::cout << "Failure! Unused parameters: " << std::endl;
MyPL.unused(std::cout);
}
}
// Solve the problem to the specified tolerances or length
Anasazi::ReturnType returnCode = MySolverMgr.solve();
testFailed = false;
if (returnCode != Anasazi::Converged) {
testFailed = true;
}
// Get the eigenvalues and eigenvectors from the eigenproblem
Anasazi::Eigensolution<ScalarType,MV> sol = problem->getSolution();
std::vector<Anasazi::Value<ScalarType> > evals = sol.Evals;
RCP<MV> evecs = sol.Evecs;
int numev = sol.numVecs;
if (numev > 0) {
std::ostringstream os;
os.setf(std::ios::scientific, std::ios::floatfield);
os.precision(6);
// Compute the direct residual
std::vector<ScalarType> normV( numev );
SerialDenseMatrix<int,ScalarType> T(numev,numev);
for (int i=0; i<numev; i++) {
T(i,i) = evals[i].realpart;
}
RCP<MV> Mvecs = MVT::Clone( *evecs, numev );
RCP<MV> Kvecs = MVT::Clone( *evecs, numev );
OPT::Apply( *K, *evecs, *Kvecs );
示例5: main
//.........这里部分代码省略.........
maxRestarts = 100;
}
MagnitudeType tol = 1.0e-6;
//
// Create parameter list to pass into the solver manager
ParameterList MyPL;
MyPL.set( "Verbosity", verbosity );
MyPL.set( "Which", which );
MyPL.set( "Block Size", blockSize );
MyPL.set( "Num Blocks", numBlocks );
MyPL.set( "Maximum Restarts", maxRestarts );
MyPL.set( "Convergence Tolerance", tol );
MyPL.set( "Use Locking", locking );
MyPL.set( "Locking Tolerance", tol/10 );
MyPL.set( "In Situ Restarting", insitu );
MyPL.set( "Num Restart Blocks", rblocks );
//
// Create the solver manager
Anasazi::BlockDavidsonSolMgr<ScalarType,MV,OP> MySolverMan(problem, MyPL);
//
// Check that the parameters were all consumed
if (MyPL.getEntryPtr("Verbosity")->isUsed() == false ||
MyPL.getEntryPtr("Which")->isUsed() == false ||
MyPL.getEntryPtr("Block Size")->isUsed() == false ||
MyPL.getEntryPtr("Num Blocks")->isUsed() == false ||
MyPL.getEntryPtr("Maximum Restarts")->isUsed() == false ||
MyPL.getEntryPtr("Convergence Tolerance")->isUsed() == false ||
MyPL.getEntryPtr("Use Locking")->isUsed() == false ||
MyPL.getEntryPtr("In Situ Restarting")->isUsed() == false ||
MyPL.getEntryPtr("Num Restart Blocks")->isUsed() == false ||
MyPL.getEntryPtr("Locking Tolerance")->isUsed() == false) {
if (verbose && MyPID==0) {
cout << "Failure! Unused parameters: " << endl;
MyPL.unused(cout);
}
}
// Solve the problem to the specified tolerances or length
Anasazi::ReturnType returnCode = MySolverMan.solve();
testFailed = false;
if (returnCode != Anasazi::Converged && shortrun==false) {
testFailed = true;
}
// Get the eigenvalues and eigenvectors from the eigenproblem
Anasazi::Eigensolution<ScalarType,MV> sol = problem->getSolution();
RCP<MV> evecs = sol.Evecs;
int numev = sol.numVecs;
if (numev > 0) {
std::ostringstream os;
os.setf(std::ios::scientific, std::ios::floatfield);
os.precision(6);
// Check the problem against the analytical solutions
if (verbose) {
double *revals = new double[numev];
for (int i=0; i<numev; i++) {
revals[i] = sol.Evals[i].realpart;
}
bool smallest = false;
if (which == "SM" || which == "SR") {
smallest = true;
}
testCase->eigenCheck( *evecs, revals, 0, smallest );