|
Teuchos - Trilinos Tools Package
Version of the Day
|
This class creates and provides basic support for TriDi matrix of templated type. More...
#include <Teuchos_SerialTriDiMatrix.hpp>
Public Types | |||||||||||||||||||||||
| typedef OrdinalType | ordinalType | ||||||||||||||||||||||
| Typedef for ordinal type. | |||||||||||||||||||||||
| typedef ScalarType | scalarType | ||||||||||||||||||||||
| Typedef for scalar type. | |||||||||||||||||||||||
Public Member Functions | |||||||||||||||||||||||
Constructor/Destructor methods. | |||||||||||||||||||||||
| SerialTriDiMatrix () | |||||||||||||||||||||||
| Default Constructor. | |||||||||||||||||||||||
| SerialTriDiMatrix (OrdinalType numRows, OrdinalType numCols, bool zeroOut=true) | |||||||||||||||||||||||
| Shaped Constructor. | |||||||||||||||||||||||
| SerialTriDiMatrix (DataAccess CV, ScalarType *values, OrdinalType numRowsCols) | |||||||||||||||||||||||
| Shaped Constructor with Values. | |||||||||||||||||||||||
| SerialTriDiMatrix (const SerialTriDiMatrix< OrdinalType, ScalarType > &Source, ETransp trans=Teuchos::NO_TRANS) | |||||||||||||||||||||||
| Copy Constructor. | |||||||||||||||||||||||
| SerialTriDiMatrix (DataAccess CV, const SerialTriDiMatrix< OrdinalType, ScalarType > &Source, OrdinalType numRowsCols, OrdinalType startRowCols=0) | |||||||||||||||||||||||
| Submatrix Copy Constructor. | |||||||||||||||||||||||
| virtual | ~SerialTriDiMatrix () | ||||||||||||||||||||||
| Destructor. | |||||||||||||||||||||||
Shaping methods. | |||||||||||||||||||||||
| int | shape (OrdinalType numRows) | ||||||||||||||||||||||
| Shape method for changing the size of a SerialTriDiMatrix, initializing entries to zero. | |||||||||||||||||||||||
| int | shapeUninitialized (OrdinalType numRows) | ||||||||||||||||||||||
Same as shape() except leaves uninitialized. | |||||||||||||||||||||||
| int | reshape (OrdinalType numRowsCols) | ||||||||||||||||||||||
| Reshaping method for changing the size of a SerialTriDiMatrix, keeping the entries. | |||||||||||||||||||||||
Set methods. | |||||||||||||||||||||||
| SerialTriDiMatrix< OrdinalType, ScalarType > & | operator= (const SerialTriDiMatrix< OrdinalType, ScalarType > &Source) | ||||||||||||||||||||||
| Copies values from one matrix to another. | |||||||||||||||||||||||
| SerialTriDiMatrix< OrdinalType, ScalarType > & | assign (const SerialTriDiMatrix< OrdinalType, ScalarType > &Source) | ||||||||||||||||||||||
| Copies values from one matrix to another. | |||||||||||||||||||||||
| SerialTriDiMatrix< OrdinalType, ScalarType > & | operator= (const ScalarType value) | ||||||||||||||||||||||
| Set all values in the matrix to a constant value. | |||||||||||||||||||||||
| int | putScalar (const ScalarType value=Teuchos::ScalarTraits< ScalarType >::zero()) | ||||||||||||||||||||||
| Set all values in the matrix to a constant value. | |||||||||||||||||||||||
Accessor methods. | |||||||||||||||||||||||
Set all values in the matrix to be random numbers. | |||||||||||||||||||||||
| ScalarType & | operator() (OrdinalType rowIndex, OrdinalType colIndex) | ||||||||||||||||||||||
| Element access method (non-const). | |||||||||||||||||||||||
| const ScalarType & | operator() (OrdinalType rowIndex, OrdinalType colIndex) const | ||||||||||||||||||||||
| Element access method (const). | |||||||||||||||||||||||
| ScalarType * | values () const | ||||||||||||||||||||||
| Column access method (non-const). | |||||||||||||||||||||||
| ScalarType * | D () const | ||||||||||||||||||||||
| ScalarType * | DL () const | ||||||||||||||||||||||
| ScalarType * | DU () const | ||||||||||||||||||||||
| ScalarType * | DU2 () const | ||||||||||||||||||||||
Mathematical methods. | |||||||||||||||||||||||
| SerialTriDiMatrix< OrdinalType, ScalarType > & | operator+= (const SerialTriDiMatrix< OrdinalType, ScalarType > &Source) | ||||||||||||||||||||||
| Add another matrix to this matrix. | |||||||||||||||||||||||
| SerialTriDiMatrix< OrdinalType, ScalarType > & | operator-= (const SerialTriDiMatrix< OrdinalType, ScalarType > &Source) | ||||||||||||||||||||||
| Subtract another matrix from this matrix. | |||||||||||||||||||||||
| SerialTriDiMatrix< OrdinalType, ScalarType > & | operator*= (const ScalarType alpha) | ||||||||||||||||||||||
Scale this matrix by alpha; *this = alpha* | |||||||||||||||||||||||
| int | scale (const ScalarType alpha) | ||||||||||||||||||||||
Scale this matrix by alpha; *this = alpha* | |||||||||||||||||||||||
| int | scale (const SerialTriDiMatrix< OrdinalType, ScalarType > &A) | ||||||||||||||||||||||
Point-wise scale this matrix by A; i.e. *this(i,j) *= A(i,j) | |||||||||||||||||||||||
Comparison methods. | |||||||||||||||||||||||
Multiply
If the matrices
If the matrices
| |||||||||||||||||||||||
| bool | operator== (const SerialTriDiMatrix< OrdinalType, ScalarType > &Operand) const | ||||||||||||||||||||||
| Equality of two matrices. | |||||||||||||||||||||||
| bool | operator!= (const SerialTriDiMatrix< OrdinalType, ScalarType > &Operand) const | ||||||||||||||||||||||
| Inequality of two matrices. | |||||||||||||||||||||||
Attribute methods. | |||||||||||||||||||||||
| OrdinalType | numRowsCols () const | ||||||||||||||||||||||
| Returns the row dimension of this matrix. | |||||||||||||||||||||||
| bool | empty () const | ||||||||||||||||||||||
| Returns the column dimension of this matrix. | |||||||||||||||||||||||
Norm methods. | |||||||||||||||||||||||
| ScalarTraits< ScalarType > ::magnitudeType | normOne () const | ||||||||||||||||||||||
| Returns the 1-norm of the matrix. | |||||||||||||||||||||||
| ScalarTraits< ScalarType > ::magnitudeType | normInf () const | ||||||||||||||||||||||
| Returns the Infinity-norm of the matrix. | |||||||||||||||||||||||
| ScalarTraits< ScalarType > ::magnitudeType | normFrobenius () const | ||||||||||||||||||||||
| Returns the Frobenius-norm of the matrix. | |||||||||||||||||||||||
I/O methods. | |||||||||||||||||||||||
| virtual void | print (std::ostream &os) const | ||||||||||||||||||||||
| Print method. Defines the behavior of the std::ostream << operator inherited from the Object class. | |||||||||||||||||||||||
This class creates and provides basic support for TriDi matrix of templated type.
Definition at line 67 of file Teuchos_SerialTriDiMatrix.hpp.
| typedef OrdinalType Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::ordinalType |
Typedef for ordinal type.
Definition at line 71 of file Teuchos_SerialTriDiMatrix.hpp.
| typedef ScalarType Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::scalarType |
Typedef for scalar type.
Definition at line 73 of file Teuchos_SerialTriDiMatrix.hpp.
| Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::SerialTriDiMatrix | ( | ) |
Default Constructor.
Creates a empty matrix of no dimension. The Shaping methods should be used to size this matrix. Values of this matrix should be set using the [], (), or = operators.
Definition at line 397 of file Teuchos_SerialTriDiMatrix.hpp.
| Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::SerialTriDiMatrix | ( | OrdinalType | numRows, |
| OrdinalType | numCols, | ||
| bool | zeroOut = true |
||
| ) |
Shaped Constructor.
| numRows | - Number of rows in matrix. |
| numCols | - Number of columns in matrix. |
| zeroOut | - Initializes values to 0 if true (default) |
Creates a shaped matrix with numRows rows and numCols cols. All values are initialized to 0 when zeroOut is true. Values of this matrix should be set using the [] or the () operators.
Definition at line 411 of file Teuchos_SerialTriDiMatrix.hpp.
| Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::SerialTriDiMatrix | ( | DataAccess | CV, |
| ScalarType * | values, | ||
| OrdinalType | numRowsCols | ||
| ) |
Shaped Constructor with Values.
| CV | - Enumerated type set to Teuchos::Copy or Teuchos::View. |
| values | - Pointer to an array of ScalarType. |
| numRows | - Number of rows in matrix. |
| numCols | - Number of columns in matrix. |
Definition at line 427 of file Teuchos_SerialTriDiMatrix.hpp.
| Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::SerialTriDiMatrix | ( | const SerialTriDiMatrix< OrdinalType, ScalarType > & | Source, |
| ETransp | trans = Teuchos::NO_TRANS |
||
| ) |
Copy Constructor.
Source transposed can be obtained if trans=Teuchos::TRANS, else a non-transposed copy of Source is made. There is no storage of the transpose state of the matrix within the SerialTriDiMatrix class, so this information will not propogate to any operation performed on a matrix that has been copy constructed in transpose. Definition at line 446 of file Teuchos_SerialTriDiMatrix.hpp.
| Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::SerialTriDiMatrix | ( | DataAccess | CV, |
| const SerialTriDiMatrix< OrdinalType, ScalarType > & | Source, | ||
| OrdinalType | numRowsCols, | ||
| OrdinalType | startRowCols = 0 |
||
| ) |
Submatrix Copy Constructor.
| CV | - Enumerated type set to Teuchos::Copy or Teuchos::View. |
| Source | - Reference to another TriDi matrix from which values are to be copied. |
| numRowsCols | - The number of rows and columns in this matrix. |
| startRowCols | - The row and col of Source from which the submatrix copy should start. |
Creates a shaped matrix with numRowsCols rows and columns, which is a submatrix of Source. If startRowCols, then the submatrix is the leading submatrix of Source. Otherwise, the (1,1) entry in the copied matrix is the (startRow, startCol) entry of Source.
Definition at line 505 of file Teuchos_SerialTriDiMatrix.hpp.
| Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::~SerialTriDiMatrix | ( | ) | [virtual] |
Destructor.
Definition at line 525 of file Teuchos_SerialTriDiMatrix.hpp.
| int Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::shape | ( | OrdinalType | numRows | ) |
Shape method for changing the size of a SerialTriDiMatrix, initializing entries to zero.
| numRowsCols | - The number of rows in this matrix. |
This method allows the user to define the dimensions of a SerialTriDiMatrix at any point. This method can be called at any point after construction. Any values previously in this object will be destroyed and the resized matrix starts of with all zero values.
Definition at line 535 of file Teuchos_SerialTriDiMatrix.hpp.
| int Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::shapeUninitialized | ( | OrdinalType | numRows | ) |
Same as shape() except leaves uninitialized.
Definition at line 548 of file Teuchos_SerialTriDiMatrix.hpp.
| int Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::reshape | ( | OrdinalType | numRowsCols | ) |
Reshaping method for changing the size of a SerialTriDiMatrix, keeping the entries.
| numRowsCols | - The number of rows in this matrix. |
This method allows the user to redefine the dimensions of a SerialTriDiMatrix at any point. This method can be called at any point after construction. Any values previously in this object will be copied into the reshaped matrix.
Definition at line 559 of file Teuchos_SerialTriDiMatrix.hpp.
| SerialTriDiMatrix< OrdinalType, ScalarType > & Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::operator= | ( | const SerialTriDiMatrix< OrdinalType, ScalarType > & | Source | ) |
Copies values from one matrix to another.
The operator= copies the values from one existing SerialTriDiMatrix to another. If Source is a view (i.e. CV = Teuchos::View), then this method will return a view. Otherwise, it will return a copy of Source. this object will be resized if it is not large enough to copy Source into.
Definition at line 632 of file Teuchos_SerialTriDiMatrix.hpp.
| SerialTriDiMatrix< OrdinalType, ScalarType > & Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::assign | ( | const SerialTriDiMatrix< OrdinalType, ScalarType > & | Source | ) |
Copies values from one matrix to another.
The operator= copies the values from one existing SerialTriDiMatrix to another if the dimension of both matrices are the same. If not, this matrix will be returned unchanged.
Definition at line 723 of file Teuchos_SerialTriDiMatrix.hpp.
| SerialTriDiMatrix<OrdinalType, ScalarType>& Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::operator= | ( | const ScalarType | value | ) | [inline] |
Set all values in the matrix to a constant value.
| value | - Value to use; |
Definition at line 185 of file Teuchos_SerialTriDiMatrix.hpp.
| int Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::putScalar | ( | const ScalarType | value = Teuchos::ScalarTraits<ScalarType>::zero() | ) |
Set all values in the matrix to a constant value.
| value | - Value to use; zero if none specified. |
Definition at line 605 of file Teuchos_SerialTriDiMatrix.hpp.
| ScalarType & Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::operator() | ( | OrdinalType | rowIndex, |
| OrdinalType | colIndex | ||
| ) | [inline] |
Element access method (non-const).
Returns the element in the ith row and jth column if A(i,j) is specified, the expression A[j][i] will return the same element.
rowIndex row and colIndex column. rowIndex and colIndex will only be checked if Teuchos is configured with --enable-teuchos-abc. Definition at line 776 of file Teuchos_SerialTriDiMatrix.hpp.
| const ScalarType & Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::operator() | ( | OrdinalType | rowIndex, |
| OrdinalType | colIndex | ||
| ) | const [inline] |
Element access method (const).
Returns the element in the ith row and jth column if A(i,j) is specified, the expression A[j][i] will return the same element.
rowIndex row and colIndex column. rowIndex and colIndex will only be checked if Teuchos is configured with --enable-teuchos-abc. Definition at line 744 of file Teuchos_SerialTriDiMatrix.hpp.
| ScalarType* Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::values | ( | ) | const [inline] |
Column access method (non-const).
Returns the pointer to the ScalarType array at the jth column if A[j] is specified, the expression A[j][i] will return the same element as A(i,j).
colIndex column ( values_+colIndex*stride_ ). colIndex will only be checked if Teuchos is configured with --enable-teuchos-abc. Column access method (const).Returns the pointer to the ScalarType array at the jth column if A[j] is specified, the expression A[j][i] will return the same element as A(i,j).
colIndex column ( values_+colIndex*stride_ ). colIndex will only be checked if Teuchos is configured with --enable-teuchos-abc. Data array access method.Definition at line 244 of file Teuchos_SerialTriDiMatrix.hpp.
| SerialTriDiMatrix< OrdinalType, ScalarType > & Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::operator+= | ( | const SerialTriDiMatrix< OrdinalType, ScalarType > & | Source | ) |
Add another matrix to this matrix.
Add Source to this if the dimension of both matrices are the same. If not, this matrix will be returned unchanged.
Definition at line 699 of file Teuchos_SerialTriDiMatrix.hpp.
| SerialTriDiMatrix< OrdinalType, ScalarType > & Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::operator-= | ( | const SerialTriDiMatrix< OrdinalType, ScalarType > & | Source | ) |
Subtract another matrix from this matrix.
Subtract Source from this if the dimension of both matrices are the same. If not, this matrix will be returned unchanged.
Definition at line 711 of file Teuchos_SerialTriDiMatrix.hpp.
| SerialTriDiMatrix< OrdinalType, ScalarType > & Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::operator*= | ( | const ScalarType | alpha | ) |
Scale this matrix by alpha; *this = alpha* *this.
| alpha | Scalar to multiply this by. |
Definition at line 903 of file Teuchos_SerialTriDiMatrix.hpp.
| int Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::scale | ( | const ScalarType | alpha | ) |
Scale this matrix by alpha; *this = alpha* *this.
| alpha | Scalar to multiply this by. |
Definition at line 910 of file Teuchos_SerialTriDiMatrix.hpp.
| int Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::scale | ( | const SerialTriDiMatrix< OrdinalType, ScalarType > & | A | ) |
Point-wise scale this matrix by A; i.e. *this(i,j) *= A(i,j)
The values of *this matrix will be point-wise scaled by the values in A. If A and this matrix are not the same dimension this will be returned unchanged.
| B | Teuchos::SerialTriDiMatrix used to perform element-wise scaling of this. |
Definition at line 921 of file Teuchos_SerialTriDiMatrix.hpp.
| bool Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::operator== | ( | const SerialTriDiMatrix< OrdinalType, ScalarType > & | Operand | ) | const |
Equality of two matrices.
Operand are of the same shape (rows and columns) and have the same entries, else False will be returned. Definition at line 875 of file Teuchos_SerialTriDiMatrix.hpp.
| bool Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::operator!= | ( | const SerialTriDiMatrix< OrdinalType, ScalarType > & | Operand | ) | const |
Inequality of two matrices.
Operand of not of the same shape (rows and columns) or don't have the same entries, else False will be returned. Definition at line 894 of file Teuchos_SerialTriDiMatrix.hpp.
| OrdinalType Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::numRowsCols | ( | ) | const [inline] |
Returns the row dimension of this matrix.
Definition at line 344 of file Teuchos_SerialTriDiMatrix.hpp.
| bool Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::empty | ( | ) | const [inline] |
Returns the column dimension of this matrix.
Returns the stride between the columns of this matrix in memory. Returns whether this matrix is empty.
Definition at line 353 of file Teuchos_SerialTriDiMatrix.hpp.
| ScalarTraits< ScalarType >::magnitudeType Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::normOne | ( | ) | const |
Returns the 1-norm of the matrix.
Definition at line 812 of file Teuchos_SerialTriDiMatrix.hpp.
| ScalarTraits< ScalarType >::magnitudeType Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::normInf | ( | ) | const |
Returns the Infinity-norm of the matrix.
Definition at line 838 of file Teuchos_SerialTriDiMatrix.hpp.
| ScalarTraits< ScalarType >::magnitudeType Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::normFrobenius | ( | ) | const |
Returns the Frobenius-norm of the matrix.
Definition at line 855 of file Teuchos_SerialTriDiMatrix.hpp.
| void Teuchos::SerialTriDiMatrix< OrdinalType, ScalarType >::print | ( | std::ostream & | os | ) | const [virtual] |
Print method. Defines the behavior of the std::ostream << operator inherited from the Object class.
Reimplemented from Teuchos::Object.
Definition at line 939 of file Teuchos_SerialTriDiMatrix.hpp.
1.7.6.1