51 int main(
int argc,
char* argv[])
68 int rows, cols, stride;
71 stride = My_Copy3.
stride();
77 Empty_Matrix.
shape( 3 );
82 My_Copy1.putScalar( 1.0 );
85 Empty_Matrix = My_Matrix;
92 My_Copy2 += My_Matrix;
97 if (Empty_Matrix == My_Matrix) {
98 std::cout<<
"The matrices are the same!" <<std::endl;
101 if (My_Copy2 != My_Matrix) {
102 std::cout<<
"The matrices are different!" <<std::endl;
106 double norm_one, norm_inf, norm_fro;
107 norm_one = My_Matrix.
normOne();
108 norm_inf = My_Matrix.
normInf();
111 std::cout << std::endl <<
"|| My_Matrix ||_1 = " << norm_one << std::endl;
112 std::cout <<
"|| My_Matrix ||_Inf = " << norm_inf << std::endl;
113 std::cout <<
"|| My_Matrix ||_F = " << norm_fro << std::endl << std::endl;
127 info = My_Solver.
factor();
129 std::cout <<
"Teuchos::SerialSpdDenseSolver::factor() returned : " << info << std::endl;
130 info = My_Solver.
solve();
132 std::cout <<
"Teuchos::SerialSpdDenseSolver::solve() returned : " << info << std::endl;
138 A1(0,0) = 1.0, A1(1,1) = 2.0;
139 A2(0,0) = 1.0, A2(1,1) = 2.0, A2(2,2) = 3.00;
145 Teuchos::symMatTripleProduct<int,double>(
Teuchos::TRANS, alpha, A2, W, C2 );
148 std::cout<< My_Matrix << std::endl;
149 std::cout<< 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.
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...