#include "Didasko_ConfigDefs.h"
#if defined(HAVE_DIDASKO_TEUCHOS)
#ifdef HAVE_MPI
#include "mpi.h"
#endif
#include "Teuchos_SerialDenseMatrix.hpp"
int main(int argc, char* argv[])
{
#ifdef HAVE_MPI
MPI_Init(&argc,&argv);
#endif
Teuchos::SerialDenseMatrix<int,double> Empty_Matrix;
Teuchos::SerialDenseMatrix<int,double> My_Matrix( 3, 4 );
Teuchos::SerialDenseMatrix<int,double> My_Copy1( My_Matrix ),
My_Copy2( Teuchos::Copy, My_Matrix, 3, 3 ),
My_Copy3( Teuchos::View, My_Matrix, 2, 3, 1, 1 );
int rows, cols, stride;
rows = My_Copy3.numRows();
cols = My_Copy3.numCols();
stride = My_Copy3.stride();
Empty_Matrix.shape( 3, 3 );
My_Matrix.reshape( 3, 3 );
My_Matrix.random();
My_Copy1.putScalar( 1.0 );
My_Copy2(1,1) = 10.0;
Empty_Matrix = My_Matrix;
Teuchos::SerialDenseMatrix<int,double> My_Prod( 3, 2 );
My_Prod.multiply( Teuchos::NO_TRANS, Teuchos::TRANS,
1.0, My_Matrix, My_Copy3, 0.0 );
My_Copy2 += My_Matrix;
My_Copy2.scale( 0.5 );
double *My_Array, *My_Column;
My_Array = My_Matrix.values();
My_Column = My_Matrix[2];
double norm_one, norm_inf, norm_fro;
norm_one = My_Matrix.normOne();
norm_inf = My_Matrix.normInf();
norm_fro = My_Matrix.normFrobenius();
if (Empty_Matrix == My_Matrix) {
cout<< "The matrices are the same!" <<endl;
}
if (My_Copy2 != My_Matrix) {
cout<< "The matrices are different!" <<endl;
}
cout<< My_Matrix << endl;
#ifdef HAVE_MPI
MPI_Finalize();
#endif
return 0;
}
#else
#include <stdlib.h>
#include <stdio.h>
#ifdef HAVE_MPI
#include "mpi.h"
#endif
int main(int argc, char *argv[])
{
#ifdef HAVE_MPI
MPI_Init(&argc,&argv);
#endif
puts("Please configure Didasko with:\n"
"--enable-teuchos");
#ifdef HAVE_MPI
MPI_Finalize();
#endif
return 0;
}
#endif