16 int main(
int argc,
char* argv[])
35 int rows, cols, stride;
38 stride = My_Copy3.
stride();
44 Empty_Matrix.
shape( 3, 3 );
49 My_Copy1.putScalar( 1.0 );
51 Empty_Matrix = My_Matrix;
60 1.0, My_Matrix, My_Copy3, 0.0 );
61 My_Copy2 += My_Matrix;
62 My_Copy2.
scale( 0.5 );
67 double *My_Array=0, *My_Column=0;
68 My_Array = My_Matrix.
values();
69 My_Column = My_Matrix[2];
74 double norm_one, norm_inf, norm_fro;
84 if (Empty_Matrix == My_Matrix) {
85 std::cout<<
"The matrices are the same!" <<std::endl;
88 if (My_Copy2 != My_Matrix) {
89 std::cout<<
"The matrices are different!" <<std::endl;
102 info = My_Solver.
factor();
104 std::cout <<
"Teuchos::SerialDenseSolver::factor() returned : " << info << std::endl;
105 info = My_Solver.
solve();
107 std::cout <<
"Teuchos::SerialDenseSolver::solve() returned : " << info << std::endl;
110 std::cout<< std::endl <<
printMat(My_Matrix) << std::endl;
111 std::cout<<
printMat(X) << std::endl;
ScalarTraits< ScalarType >::magnitudeType normOne() const
Returns the 1-norm of the matrix.
ScalarType * values() const
Data array access method.
Templated serial dense matrix class.
SerialBandDenseMatrixPrinter< OrdinalType, ScalarType > printMat(const SerialBandDenseMatrix< OrdinalType, ScalarType > &obj)
Return SerialBandDenseMatrix ostream manipulator Use as:
int solve()
Computes the solution X to AX = B for the this matrix and the B provided to SetVectors()..
int multiply(ETransp transa, ETransp transb, ScalarType alpha, const SerialDenseMatrix< OrdinalType, ScalarType > &A, const SerialDenseMatrix< OrdinalType, ScalarType > &B, ScalarType beta)
Multiply A * B and add them to this; this = beta * this + alpha*A*B.
int scale(const ScalarType alpha)
Scale this matrix by alpha; *this = alpha**this.
This class creates and provides basic support for dense vectors of templated type as a specialization...
ScalarTraits< ScalarType >::magnitudeType normFrobenius() const
Returns the Frobenius-norm of the matrix.
Templated class for solving dense linear problems.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
std::string Teuchos_Version()
int main(int argc, char *argv[])
OrdinalType numCols() const
Returns the column dimension of this matrix.
ScalarTraits< ScalarType >::magnitudeType normInf() const
Returns the Infinity-norm of the matrix.
int random()
Set all values in the matrix to be random numbers.
int setVectors(const RCP< SerialDenseMatrix< OrdinalType, ScalarType > > &X, const RCP< SerialDenseMatrix< OrdinalType, ScalarType > > &B)
Sets the pointers for left and right hand side vector(s).
int reshape(OrdinalType numRows, OrdinalType numCols)
Reshaping method for changing the size of a SerialDenseMatrix, keeping the entries.
Templated serial dense vector class.
int factor()
Computes the in-place LU factorization of the matrix using the LAPACK routine _GETRF.
int shape(OrdinalType numRows, OrdinalType numCols)
Shape method for changing the size of a SerialDenseMatrix, initializing entries to zero...
#define TEUCHOS_ASSERT_EQUALITY(val1, val2)
This macro is checks that to numbers are equal and if not then throws an exception with a good error ...
Reference-counted pointer class and non-member templated function implementations.
OrdinalType stride() const
Returns the stride between the columns of this matrix in memory.
OrdinalType numRows() const
Returns the row dimension of this matrix.
A class for solving dense linear problems.
int setMatrix(const RCP< SerialDenseMatrix< OrdinalType, ScalarType > > &A)
Sets the pointers for coefficient matrix.
This class creates and provides basic support for dense rectangular matrix of templated type...