48 #ifdef HAVE_EPETRA_TEUCHOS 
   56 #ifdef HAVE_EPETRA_TEUCHOS 
   58     fancyOut = Teuchos::VerboseObjectBase::getDefaultOStream();
 
   59   std::ostream &out = *fancyOut;
 
   61   std::ostream &out = std::cout;
 
   68     double *residual = 
new double[NumVectors];
 
   93     double **App, **Bpp, **Cpp;
 
   99     App = 
new double *[NumVectors];
 
  100     Bpp = 
new double *[NumVectors];
 
  101     Cpp = 
new double *[NumVectors];
 
  102     for (i=0; i<NumVectors; i++) App[i] = 
new double[A.
MyLength()+i];
 
  103     for (i=0; i<NumVectors; i++) Bpp[i] = 
new double[B.
MyLength()+i];
 
  104     for (i=0; i<NumVectors; i++) Cpp[i] = 
new double[C.
MyLength()+i];
 
  110     for (
int strided = 0; strided<2; strided++){
 
  114   char transa = 
'N'; 
if (i>1) transa = 
'T';
 
  115   char transb = 
'N'; 
if (i%2!=0) transb = 
'T';
 
  116   double alpha = (double) i+1;
 
  117   double beta  = (double) (i/2);
 
  123         Ap = &A; Bp = &B; Cp = &C;
 
  132     localierr = Cp->
Multiply(transa, transb, alpha, *Ap, *Bp, beta);
 
  134       ierr += Cp->
Update(-1.0, C_GEMM, 1.0);
 
  135       ierr += Cp->
Norm2(residual);
 
  137       if (verbose && ierr==0)
 
  139     out << 
"XXXXX Replicated Local Vector GEMM tests";
 
  141       out << 
" (Strided Multivectors)" << endl;
 
  143       out << 
" (Non-Strided Multivectors)" << endl;
 
  144     out << 
"  alpha = " << alpha << 
",  beta = " << beta <<
", transa = "<<transa
 
  145         <<
", transb = " << transb;
 
  147       if (ierr==0 && 
BadResidual(verbose,residual)) 
return(-1);
 
  152     for (i=0; i<NumVectors; i++)
 
  181     ierr += C.
Multiply(transa, transb, alpha, A, B, beta);
 
  182     ierr += C.
Update(-1.0, C_GEMM, 1.0);
 
  183     ierr += C.
Norm2(residual);
 
  185     if (verbose && ierr==0)
 
  187   out << 
"XXXXX Generalized 2D dot product via GEMM call     " << endl;
 
  188   out << 
"  alpha = " << alpha << 
",  beta = " << beta <<
", transa = "<<transa
 
  189        <<
", transb = " << transb;
 
  210   char transb = 
'N'; 
if (i>0) transb = 
'T';
 
  215   ierr += C.
Multiply(transa, transb, alpha, A, B, beta);
 
  216   ierr += C.
Update(-1.0, C_GEMM, 1.0);
 
  217   ierr += C.
Norm2(residual);
 
  221       out << 
"XXXXX Generalized 2D vector update via GEMM call     " << endl;
 
  222       out << 
"  alpha = " << alpha << 
",  beta = " << beta <<
", transa = "<<transa
 
  223      <<
", transb = " << transb;
 
  238   double *residual = 
new double[NumVectors];
 
  240 #ifdef HAVE_EPETRA_TEUCHOS 
  242     fancyOut = Teuchos::VerboseObjectBase::getDefaultOStream();
 
  243   std::ostream &out = *fancyOut;
 
  245   std::ostream &out = std::cout;
 
  263   double *dotvec_AB   = 
new double[NumVectors];
 
  264   double *norm1_A     = 
new double[NumVectors];
 
  265   double *norm2_sqrtA = 
new double[NumVectors];
 
  266   double *norminf_A = 
new double[NumVectors];
 
  267   double *normw_A = 
new double[NumVectors];
 
  268   double *minval_A = 
new double[NumVectors];
 
  269   double *maxval_A = 
new double[NumVectors];
 
  270   double *meanval_A = 
new double[NumVectors];
 
  280            C_plusB, dotvec_AB, norm1_A, norm2_sqrtA, norminf_A,
 
  281            normw_A, Weights, minval_A, maxval_A, meanval_A);
 
  286 #ifdef HAVE_EPETRA_ARRAY_BOUNDS_CHECK 
  288     if (verbose) out << 
"XXXXX Testing operator[A.MyLength()] bounds check     ";
 
  293   catch ( 
const int& err_code ) {
 
  294     if (verbose) out << 
"\t Checked OK" << endl;
 
  298     if (verbose) out << 
"XXXXX Testing operator[-1] bounds check     ";
 
  303   catch ( 
const int& err_code ) {
 
  304     if (verbose) out << 
"\t Checked OK" << endl;
 
  309   if (verbose) out << 
"XXXXX Testing alpha * A     ";
 
  316   if (err) ierr += err;
 
  322   if (verbose) out << 
"XXXXX Testing C = alpha * A + B      ";
 
  329   if (err) ierr += err;
 
  335   if (verbose) out << 
"XXXXX Testing C += B      ";
 
  342   if (err) ierr += err;
 
  348   if (verbose) out << 
"XXXXX Testing A.dotProd(B)     ";
 
  350   double *dotvec = residual;
 
  352   BLAS.
AXPY(NumVectors,-1.0,dotvec_AB,dotvec);
 
  354   if (err) ierr += err;
 
  360   if (verbose) out << 
"XXXXX Testing norm1_A      ";
 
  362   double *norm1 = residual;
 
  364   BLAS.
AXPY(NumVectors,-1.0,norm1_A,norm1);
 
  366   if (err) ierr += err;
 
  372   if (verbose) out << 
"XXXXX Testing norm2_sqrtA     ";
 
  374   double *norm2 = residual;
 
  376   BLAS.
AXPY(NumVectors,-1.0,norm2_sqrtA,norm2);
 
  378   if (err) ierr += err;
 
  384   if (verbose) out << 
"XXXXX Testing norminf_A     ";
 
  386   double *norminf = residual;
 
  388   BLAS.
AXPY(NumVectors,-1.0,norminf_A,norminf);
 
  390   if (err) ierr += err;
 
  396   if (verbose) out << 
"XXXXX Testing normw_A     ";
 
  398   double *normw = residual;
 
  400   BLAS.
AXPY(NumVectors,-1.0,normw_A,normw);
 
  402   if (err) ierr += err;
 
  408   if (verbose) out << 
"XXXXX Testing minval_A     ";
 
  410   double *minval = residual;
 
  412   BLAS.
AXPY(NumVectors,-1.0,minval_A,minval);
 
  414   if (err) ierr += err;
 
  420   if (verbose) out << 
"XXXXX Testing maxval_A     ";
 
  422   double *maxval = residual;
 
  424   BLAS.
AXPY(NumVectors,-1.0,maxval_A,maxval);
 
  426   if (err) ierr += err;
 
  432   if (verbose) out << 
"XXXXX Testing meanval_A     ";
 
  434   double *meanval = residual;
 
  436   BLAS.
AXPY(NumVectors,-1.0,meanval_A,meanval);
 
  438   if (err) ierr += err;
 
  444   if (verbose) out << 
"XXXXX Testing abs_A     ";
 
  451   if (err) ierr += err;
 
  460   delete [] norm2_sqrtA;
 
  474 #ifdef HAVE_EPETRA_TEUCHOS 
  476     fancyOut = Teuchos::VerboseObjectBase::getDefaultOStream();
 
  477   std::ostream &out = *fancyOut;
 
  479   std::ostream &out = std::cout;
 
  482   double threshold = 5.0E-6;
 
  484     if (Residual[0]>threshold) {
 
  486       if (verbose) out << endl << 
"     Residual = " << Residual[0];
 
  489     if (ierr==0) out << 
"\t Checked OK" << endl;
 
int Abs(const Epetra_MultiVector &A)
Puts element-wise absolute values of input Multi-vector in target. 
int Random()
Set multi-vector values to random numbers. 
void AXPY(const int N, const float ALPHA, const float *X, float *Y, const int INCX=1, const int INCY=1) const 
Epetra_BLAS vector update function (SAXPY) 
int MaxValue(double *Result) const 
Compute maximum value of each vector in multi-vector. 
#define EPETRA_TEST_ERR(a, b)
int NormWeighted(const Epetra_MultiVector &Weights, double *Result) const 
Compute Weighted 2-norm (RMS Norm) of each vector in multi-vector. 
int MyLength() const 
Returns the local vector length on the calling processor of vectors in the multi-vector. 
static void SetTracebackMode(int TracebackModeValue)
Set the value of the Epetra_Object error traceback report mode. 
int MatrixTests(const Epetra_BlockMap &Map, const Epetra_LocalMap &LocalMap, int NumVectors, bool verbose)
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer. 
int BuildMatrixTests(Epetra_MultiVector &C, const char TransA, const char TransB, const double alpha, Epetra_MultiVector &A, Epetra_MultiVector &B, const double beta, Epetra_MultiVector &C_GEMM)
int Dot(const Epetra_MultiVector &A, double *Result) const 
Computes dot product of each corresponding pair of vectors. 
Epetra_BLAS: The Epetra BLAS Wrapper Class. 
int Scale(double ScalarValue)
Scale the current values of a multi-vector, this = ScalarValue*this. 
bool Residual(int N, int NRHS, double *A, int LDA, bool Transpose, double *X, int LDX, double *B, int LDB, double *resid)
Epetra_Comm: The Epetra Communication Abstract Base Class. 
int NormInf(double *Result) const 
Compute Inf-norm of each vector in multi-vector. 
Epetra_BlockMap: A class for partitioning block element vectors and matrices. 
int BuildVectorTests(Epetra_Vector &C, const double alpha, Epetra_Vector &A, Epetra_Vector &sqrtA, Epetra_Vector &B, Epetra_Vector &C_alphaA, Epetra_Vector &C_alphaAplusB, Epetra_Vector &C_plusB, double *const dotvec_AB, double *const norm1_A, double *const norm2_sqrtA, double *const norminf_A, double *const normw_A, Epetra_Vector &Weights, double *const minval_A, double *const maxval_A, double *const meanval_A)
int MeanValue(double *Result) const 
Compute mean (average) value of each vector in multi-vector. 
int MinValue(double *Result) const 
Compute minimum value of each vector in multi-vector. 
const Epetra_Comm & Comm() const 
Access function for Epetra_Comm communicator. 
int Update(double ScalarA, const Epetra_MultiVector &A, double ScalarThis)
Update multi-vector values with scaled values of A, this = ScalarThis*this + ScalarA*A. 
int Norm1(double *Result) const 
Compute 1-norm of each vector in multi-vector. 
int Multiply(char TransA, char TransB, double ScalarAB, const Epetra_MultiVector &A, const Epetra_MultiVector &B, double ScalarThis)
Matrix-Matrix multiplication, this = ScalarThis*this + ScalarAB*A*B. 
int ExtractCopy(double *V) const 
Put vector values into user-provided array. 
int Norm2(double *Result) const 
Compute 2-norm of each vector in multi-vector. 
int VectorTests(const Epetra_BlockMap &Map, bool verbose)
Epetra_LocalMap: A class for replicating vectors and matrices across multiple processors. 
int BadResidual(bool verbose, double *Residual, int NumVectors)