17 int main(
int argc,
char* argv[])
34 int rows, cols, stride;
37 stride = My_Copy3.
stride();
43 Empty_Matrix.
shape( 3 );
48 My_Copy1.putScalar( 1.0 );
51 Empty_Matrix = My_Matrix;
58 My_Copy2 += My_Matrix;
63 if (Empty_Matrix == My_Matrix) {
64 std::cout<<
"The matrices are the same!" <<std::endl;
67 if (My_Copy2 != My_Matrix) {
68 std::cout<<
"The matrices are different!" <<std::endl;
72 double norm_one, norm_inf, norm_fro;
77 std::cout << std::endl <<
"|| My_Matrix ||_1 = " << norm_one << std::endl;
78 std::cout <<
"|| My_Matrix ||_Inf = " << norm_inf << std::endl;
79 std::cout <<
"|| My_Matrix ||_F = " << norm_fro << std::endl << std::endl;
95 std::cout <<
"Teuchos::SerialSpdDenseSolver::factor() returned : " << info << std::endl;
96 info = My_Solver.
solve();
98 std::cout <<
"Teuchos::SerialSpdDenseSolver::solve() returned : " << info << std::endl;
104 A1(0,0) = 1.0, A1(1,1) = 2.0;
105 A2(0,0) = 1.0, A2(1,1) = 2.0, A2(2,2) = 3.00;
111 Teuchos::symMatTripleProduct<int,double>(
Teuchos::TRANS, alpha, A2, W, C2 );
114 std::cout<<
printMat(My_Matrix) << std::endl;
115 std::cout<<
printMat(X) << std::endl;
A class for constructing and using Hermitian positive definite dense matrices.
Non-member helper functions on the templated serial, dense matrix/vector classes. ...
Templated serial dense matrix class.
SerialBandDenseMatrixPrinter< OrdinalType, ScalarType > printMat(const SerialBandDenseMatrix< OrdinalType, ScalarType > &obj)
Return SerialBandDenseMatrix ostream manipulator Use as:
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 shape(OrdinalType numRowsCols)
Set dimensions of a Teuchos::SerialSymDenseMatrix object; init values to zero.
int factor()
Computes the in-place Cholesky factorization of the matrix using the LAPACK routine DPOTRF...
This class creates and provides basic support for symmetric, positive-definite dense matrices of temp...
OrdinalType numRows() const
Returns the row dimension of this matrix.
ScalarTraits< ScalarType >::magnitudeType normInf() const
Returns the Infinity-norm of the matrix.
int reshape(OrdinalType numRowsCols)
Reshape a Teuchos::SerialSymDenseMatrix object.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
int setMatrix(const RCP< SerialSymDenseMatrix< OrdinalType, ScalarType > > &A_in)
Sets the pointers for coefficient matrix.
int solve()
Computes the solution X to AX = B for the this matrix and the B provided to SetVectors()..
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).
ScalarTraits< ScalarType >::magnitudeType normOne() const
Returns the 1-norm of the matrix.
int random(const ScalarType bias=0.1 *Teuchos::ScalarTraits< ScalarType >::one())
Set all values in the active area (upper/lower triangle) of this matrix to be random numbers...
std::string Teuchos_Version()
Templated serial, dense, symmetric matrix class.
int main(int argc, char *argv[])
Templated class for constructing and using Hermitian positive definite dense matrices.
OrdinalType stride() const
Returns the stride between the columns of this matrix in memory.
OrdinalType numCols() const
Returns the column dimension of this matrix.
ScalarTraits< ScalarType >::magnitudeType normFrobenius() const
Returns the Frobenius-norm of the matrix.
#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.
This class creates and provides basic support for dense rectangular matrix of templated type...