61 #ifdef HAVE_BELOS_TRIUTILS 
   62 #include "Trilinos_Util_iohb.h" 
   69 using namespace Teuchos;
 
   71 int main(
int argc, 
char *argv[]) {
 
   74   typedef std::complex<double> ST;
 
   76   typedef std::complex<double> ST;
 
   78   std::cout << 
"Not compiled with std::complex support." << std::endl;
 
   79   std::cout << 
"End Result: TEST FAILED" << std::endl;
 
   84   typedef SCT::magnitudeType                MT;
 
   90   ST zero = SCT::zero();
 
  103     bool norm_failure = 
false;
 
  104     bool proc_verbose = 
false;
 
  105     bool use_single_red = 
false;
 
  109     std::string 
filename(
"mhd1280b.cua");
 
  113     cmdp.
setOption(
"verbose",
"quiet",&verbose,
"Print messages and results.");
 
  114     cmdp.
setOption(
"pseudo",
"regular",&pseudo,
"Use pseudo-block CG to solve the linear systems.");
 
  115     cmdp.
setOption(
"frequency",&frequency,
"Solvers frequency for printing residuals (#iters).");
 
  116     cmdp.
setOption(
"filename",&filename,
"Filename for Harwell-Boeing test matrix.");
 
  117     cmdp.
setOption(
"tol",&tol,
"Relative residual tolerance used by CG solver.");
 
  118     cmdp.
setOption(
"num-rhs",&numrhs,
"Number of right-hand sides to be solved for.");
 
  119     cmdp.
setOption(
"blocksize",&blocksize,
"Block size used by CG .");
 
  120     cmdp.
setOption(
"use-single-red",
"use-standard-red",&use_single_red,
"Use single-reduction variant of CG iteration.");
 
  125     proc_verbose = verbose && (MyPID==0);  
 
  133 #ifndef HAVE_BELOS_TRIUTILS 
  134     std::cout << 
"This test requires Triutils. Please configure with --enable-triutils." << std::endl;
 
  136       std::cout << 
"End Result: TEST FAILED" << std::endl;
 
  147     info = readHB_newmat_double(filename.c_str(),&dim,&dim2,&nnz,
 
  148         &colptr,&rowind,&dvals);
 
  149     if (info == 0 || nnz < 0) {
 
  151         std::cout << 
"Error reading '" << filename << 
"'" << std::endl;
 
  152         std::cout << 
"End Result: TEST FAILED" << std::endl;
 
  158     for (
int ii=0; ii<nnz; ii++) {
 
  159       cvals[ii] = ST(dvals[ii*2],dvals[ii*2+1]);
 
  168     int maxits = dim/blocksize; 
 
  171     belosList.
set( 
"Block Size", blocksize );                
 
  172     belosList.
set( 
"Maximum Iterations", maxits );           
 
  173     belosList.
set( 
"Convergence Tolerance", tol );           
 
  174     if ((blocksize == 1) && use_single_red)
 
  175       belosList.
set( 
"Use Single Reduction", use_single_red ); 
 
  180         belosList.
set( 
"Output Frequency", frequency );
 
  191     MVT::MvRandom( *soln );
 
  192     OPT::Apply( *A, *soln, *rhs );
 
  193     MVT::MvInit( *soln, zero );
 
  199     bool set = problem->setProblem();
 
  202         std::cout << std::endl << 
"ERROR:  Belos::LinearProblem failed to set up correctly!" << std::endl;
 
  221       std::cout << std::endl << std::endl;
 
  222       std::cout << 
"Dimension of matrix: " << dim << std::endl;
 
  223       std::cout << 
"Number of right-hand sides: " << numrhs << std::endl;
 
  224       std::cout << 
"Block size used by solver: " << blocksize << std::endl;
 
  225       std::cout << 
"Max number of CG iterations: " << maxits << std::endl;
 
  226       std::cout << 
"Relative residual tolerance: " << tol << std::endl;
 
  227       std::cout << std::endl;
 
  237     OPT::Apply( *A, *soln, *temp );
 
  238     MVT::MvAddMv( one, *rhs, -one, *temp, *temp );
 
  239     std::vector<MT> norm_num(numrhs), norm_denom(numrhs);
 
  240     MVT::MvNorm( *temp, norm_num );
 
  241     MVT::MvNorm( *rhs, norm_denom );
 
  242     for (
int i=0; i<numrhs; ++i) {
 
  244         std::cout << 
"Relative residual "<<i<<
" : " << norm_num[i] / norm_denom[i] << std::endl;
 
  245       if ( norm_num[i] / norm_denom[i] > tol ) {
 
  251     MT ach_tol = solver->achievedTol();
 
  253       std::cout << 
"Achieved tol : "<<ach_tol<<std::endl;
 
  265         std::cout << 
"End Result: TEST PASSED" << std::endl;
 
  268         std::cout << 
"End Result: TEST FAILED" << std::endl;
 
  273   return ( success ? EXIT_SUCCESS : EXIT_FAILURE );
 
std::string Belos_Version()
 
int main(int argc, char *argv[])
 
The Belos::PseudoBlockCGSolMgr provides a solver manager for the BlockCG linear solver. 
 
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
 
The Belos::BlockCGSolMgr provides a powerful and fully-featured solver manager over the CG and BlockC...
 
Traits class which defines basic operations on multivectors. 
 
The Belos::PseudoBlockCGSolMgr provides a powerful and fully-featured solver manager over the pseudo-...
 
Simple example of a user's defined Belos::MultiVec class. 
 
Alternative run-time polymorphic interface for operators. 
 
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
 
void setOption(const char option_true[], const char option_false[], bool *option_val, const char documentation[]=NULL)
 
#define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG)
 
A linear system to solve, and its associated information. 
 
Class which describes the linear problem to be solved by the iterative solver. 
 
EParseCommandLineReturn parse(int argc, char *argv[], std::ostream *errout=&std::cerr) const 
 
ReturnType
Whether the Belos solve converged for all linear systems. 
 
The Belos::BlockCGSolMgr provides a solver manager for the BlockCG linear solver. ...
 
Interface for multivectors used by Belos' linear solvers. 
 
Class which defines basic traits for the operator type. 
 
Belos header file which uses auto-configuration information to include necessary C++ headers...
 
Simple example of a user's defined Belos::Operator class.