#include <Teuchos_SerialDenseMatrix.hpp>
Public Member Functions | |
Constructor/Destructor methods. | |
SerialDenseMatrix () | |
Default Constructor. | |
SerialDenseMatrix (OrdinalType numRows, OrdinalType numCols, bool zeroOut=true) | |
Shaped Constructor. | |
SerialDenseMatrix (DataAccess CV, ScalarType *values, OrdinalType stride, OrdinalType numRows, OrdinalType numCols) | |
Shaped Constructor with Values. | |
SerialDenseMatrix (const SerialDenseMatrix< OrdinalType, ScalarType > &Source, ETransp trans=Teuchos::NO_TRANS) | |
Copy Constructor. | |
SerialDenseMatrix (DataAccess CV, const SerialDenseMatrix< OrdinalType, ScalarType > &Source, OrdinalType numRows, OrdinalType numCols, OrdinalType startRow=0, OrdinalType startCol=0) | |
Submatrix Copy Constructor. | |
virtual | ~SerialDenseMatrix () |
Destructor. | |
Shaping methods. | |
int | shape (OrdinalType numRows, OrdinalType numCols) |
Shape method for changing the size of a SerialDenseMatrix, initializing entries to zero. | |
int | shapeUninitialized (OrdinalType numRows, OrdinalType numCols) |
Same as shape() except leaves uninitialized. | |
int | reshape (OrdinalType numRows, OrdinalType numCols) |
Reshaping method for changing the size of a SerialDenseMatrix, keeping the entries. | |
Set methods. | |
SerialDenseMatrix< OrdinalType, ScalarType > & | operator= (const SerialDenseMatrix< OrdinalType, ScalarType > &Source) |
Copies values from one matrix to another. | |
SerialDenseMatrix< OrdinalType, ScalarType > & | assign (const SerialDenseMatrix< OrdinalType, ScalarType > &Source) |
Copies values from one matrix to another. | |
int | putScalar (const ScalarType value=Teuchos::ScalarTraits< ScalarType >::zero()) |
Set all values in the matrix to a constant value. | |
int | random () |
Set all values in the matrix to be random numbers. | |
Accessor methods. | |
ScalarType & | operator() (OrdinalType rowIndex, OrdinalType colIndex) |
Element access method (non-const). | |
const ScalarType & | operator() (OrdinalType rowIndex, OrdinalType colIndex) const |
Element access method (const). | |
ScalarType * | operator[] (OrdinalType colIndex) |
Column access method (non-const). | |
const ScalarType * | operator[] (OrdinalType colIndex) const |
Column access method (const). | |
ScalarType * | values () const |
Data array access method. | |
Mathematical methods. | |
SerialDenseMatrix< OrdinalType, ScalarType > & | operator+= (const SerialDenseMatrix< OrdinalType, ScalarType > &Source) |
Add another matrix to this matrix. | |
SerialDenseMatrix< OrdinalType, ScalarType > & | operator-= (const SerialDenseMatrix< OrdinalType, ScalarType > &Source) |
Subtract another matrix from this matrix. | |
SerialDenseMatrix< 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 SerialDenseMatrix< OrdinalType, ScalarType > &A) |
Point-wise scale this matrix by A ; i.e. *this(i,j) *= A(i,j). | |
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 | multiply (ESide sideA, ScalarType alpha, const SerialSymDenseMatrix< OrdinalType, ScalarType > &A, const SerialDenseMatrix< OrdinalType, ScalarType > &B, ScalarType beta) |
Multiply A and B and add them to this; this = beta * this + alpha*A*B or this = beta * this + alpha*B*A . | |
Comparison methods. | |
bool | operator== (const SerialDenseMatrix< OrdinalType, ScalarType > &Operand) |
Equality of two matrices. | |
bool | operator!= (const SerialDenseMatrix< OrdinalType, ScalarType > &Operand) |
Inequality of two matrices. | |
Attribute methods. | |
OrdinalType | numRows () const |
Returns the row dimension of this matrix. | |
OrdinalType | numCols () const |
Returns the column dimension of this matrix. | |
OrdinalType | stride () const |
Returns the stride between the columns of this matrix in memory. | |
bool | empty () const |
Returns whether this matrix is empty. | |
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. | |
Protected Member Functions | |
void | copyMat (ScalarType *inputMatrix, OrdinalType strideInput, OrdinalType numRows, OrdinalType numCols, ScalarType *outputMatrix, OrdinalType strideOutput, OrdinalType startRow, OrdinalType startCol, ScalarType alpha=ScalarTraits< ScalarType >::zero()) |
void | deleteArrays () |
void | checkIndex (OrdinalType rowIndex, OrdinalType colIndex=0) const |
Protected Attributes | |
OrdinalType | numRows_ |
OrdinalType | numCols_ |
OrdinalType | stride_ |
bool | valuesCopied_ |
ScalarType * | values_ |
Definition at line 73 of file Teuchos_SerialDenseMatrix.hpp.
Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::SerialDenseMatrix | ( | ) | [inline] |
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 392 of file Teuchos_SerialDenseMatrix.hpp.
Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::SerialDenseMatrix | ( | OrdinalType | numRows, | |
OrdinalType | numCols, | |||
bool | zeroOut = true | |||
) | [inline] |
Shaped Constructor.
numRows | - Number of rows in matrix. | |
numCols | - Number of columns in matrix. | |
zeroOut | - Initializes values to 0 if true (default) |
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 397 of file Teuchos_SerialDenseMatrix.hpp.
Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::SerialDenseMatrix | ( | DataAccess | CV, | |
ScalarType * | values, | |||
OrdinalType | stride, | |||
OrdinalType | numRows, | |||
OrdinalType | numCols | |||
) | [inline] |
Shaped Constructor with Values.
CV | - Enumerated type set to Teuchos::Copy or Teuchos::View. | |
values | - Pointer to an array of ScalarType. The first column starts at values , the second at values+stride , etc. | |
stride | - The stride between the columns of the matrix in memory. | |
numRows | - Number of rows in matrix. | |
numCols | - Number of columns in matrix. |
Definition at line 409 of file Teuchos_SerialDenseMatrix.hpp.
Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::SerialDenseMatrix | ( | const SerialDenseMatrix< OrdinalType, ScalarType > & | Source, | |
ETransp | trans = Teuchos::NO_TRANS | |||
) | [inline] |
Copy Constructor.
Source
transposed can be obtained if trans=TeuchosTRANS
, else
a non-transposed copy of Source
is made. There is no storage of the transpose state of the matrix within the SerialDenseMatrix class, so this information will not propogate to any operation performed on a matrix that has been copy constructed in transpose. Definition at line 426 of file Teuchos_SerialDenseMatrix.hpp.
Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::SerialDenseMatrix | ( | DataAccess | CV, | |
const SerialDenseMatrix< OrdinalType, ScalarType > & | Source, | |||
OrdinalType | numRows, | |||
OrdinalType | numCols, | |||
OrdinalType | startRow = 0 , |
|||
OrdinalType | startCol = 0 | |||
) | [inline] |
Submatrix Copy Constructor.
CV | - Enumerated type set to Teuchos::Copy or Teuchos::View. | |
Source | - Reference to another dense matrix from which values are to be copied. | |
numRows | - The number of rows in this matrix. | |
numCols | - The number of columns in this matrix. | |
startRow | - The row of Source from which the submatrix copy should start. | |
startCol | - The column of Source from which the submatrix copy should start. |
numRows
rows and numCols
columns, which is a submatrix of Source
. If startRow
and startCol
are not given, 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 463 of file Teuchos_SerialDenseMatrix.hpp.
Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::~SerialDenseMatrix | ( | ) | [inline, virtual] |
SerialDenseMatrix< OrdinalType, ScalarType > & Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::assign | ( | const SerialDenseMatrix< OrdinalType, ScalarType > & | Source | ) | [inline] |
Copies values from one matrix to another.
The operator= copies the values from one existing SerialDenseMatrix to another if the dimension of both matrices are the same. If not, this matrix will be returned unchanged.
Definition at line 668 of file Teuchos_SerialDenseMatrix.hpp.
void Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::checkIndex | ( | OrdinalType | rowIndex, | |
OrdinalType | colIndex = 0 | |||
) | const [inline, protected] |
Definition at line 939 of file Teuchos_SerialDenseMatrix.hpp.
void Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::copyMat | ( | ScalarType * | inputMatrix, | |
OrdinalType | strideInput, | |||
OrdinalType | numRows, | |||
OrdinalType | numCols, | |||
ScalarType * | outputMatrix, | |||
OrdinalType | strideOutput, | |||
OrdinalType | startRow, | |||
OrdinalType | startCol, | |||
ScalarType | alpha = ScalarTraits<ScalarType>::zero() | |||
) | [inline, protected] |
Definition at line 960 of file Teuchos_SerialDenseMatrix.hpp.
void Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::deleteArrays | ( | void | ) | [inline, protected] |
Definition at line 949 of file Teuchos_SerialDenseMatrix.hpp.
bool Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::empty | ( | ) | const [inline] |
int Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::multiply | ( | ESide | sideA, | |
ScalarType | alpha, | |||
const SerialSymDenseMatrix< OrdinalType, ScalarType > & | A, | |||
const SerialDenseMatrix< OrdinalType, ScalarType > & | B, | |||
ScalarType | beta | |||
) | [inline] |
Multiply A
and B
and add them to this; this = beta
* this + alpha*A*B
or this = beta
* this + alpha*B*A
.
sideA | - Which side is A on for the multiplication to B, A*B (Teuchos::LEFT_SIDE) or B*A (Teuchos::RIGHT_SIDE). | |
alpha | - The scaling factor for A * B , or B * A . | |
A | - SerialSymDenseMatrix (a serial SPD dense matrix) | |
B | - SerialDenseMatrix (a serial dense matrix) | |
beta | - The scaling factor for this. |
A
and B
are not of the right dimension, consistent with this, then this matrix will not be altered and -1 will be returned. Definition at line 885 of file Teuchos_SerialDenseMatrix.hpp.
int Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::multiply | ( | ETransp | transa, | |
ETransp | transb, | |||
ScalarType | alpha, | |||
const SerialDenseMatrix< OrdinalType, ScalarType > & | A, | |||
const SerialDenseMatrix< OrdinalType, ScalarType > & | B, | |||
ScalarType | beta | |||
) | [inline] |
Multiply A
* B
and add them to this; this = beta
* this + alpha*A*B
.
transa | - Use the transpose of A if transa = Teuchos::TRANS, else don't use the transpose if transa = Teuchos::NOTRANS. | |
transb | - Use the transpose of B if transb = Teuchos::TRANS, else don't use the transpose if transb = Teuchos::NOTRANS. | |
alpha | - The scaling factor for A * B . | |
A | - SerialDenseMatrix | |
B | - SerialDenseMatrix | |
beta | - The scaling factor for this. |
A
and B
are not of the right dimension, consistent with this, then this matrix will not be altered and -1 will be returned. Definition at line 864 of file Teuchos_SerialDenseMatrix.hpp.
ScalarTraits< ScalarType >::magnitudeType Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::normFrobenius | ( | ) | const [inline] |
Returns the Frobenius-norm of the matrix.
Definition at line 770 of file Teuchos_SerialDenseMatrix.hpp.
ScalarTraits< ScalarType >::magnitudeType Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::normInf | ( | ) | const [inline] |
Returns the Infinity-norm of the matrix.
Definition at line 753 of file Teuchos_SerialDenseMatrix.hpp.
ScalarTraits< ScalarType >::magnitudeType Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::normOne | ( | ) | const [inline] |
OrdinalType Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::numCols | ( | ) | const [inline] |
Returns the column dimension of this matrix.
Definition at line 344 of file Teuchos_SerialDenseMatrix.hpp.
OrdinalType Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::numRows | ( | ) | const [inline] |
Returns the row dimension of this matrix.
Definition at line 341 of file Teuchos_SerialDenseMatrix.hpp.
bool Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::operator!= | ( | const SerialDenseMatrix< OrdinalType, ScalarType > & | Operand | ) | [inline] |
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 814 of file Teuchos_SerialDenseMatrix.hpp.
const ScalarType & Teuchos::SerialDenseMatrix< 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 697 of file Teuchos_SerialDenseMatrix.hpp.
ScalarType & Teuchos::SerialDenseMatrix< 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 688 of file Teuchos_SerialDenseMatrix.hpp.
SerialDenseMatrix< OrdinalType, ScalarType > & Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::operator*= | ( | const ScalarType | alpha | ) | [inline] |
Scale this
matrix by alpha
; *this
= alpha*
*this
.
alpha | Scalar to multiply this by. |
Definition at line 824 of file Teuchos_SerialDenseMatrix.hpp.
SerialDenseMatrix< OrdinalType, ScalarType > & Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::operator+= | ( | const SerialDenseMatrix< OrdinalType, ScalarType > & | Source | ) | [inline] |
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 644 of file Teuchos_SerialDenseMatrix.hpp.
SerialDenseMatrix< OrdinalType, ScalarType > & Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::operator-= | ( | const SerialDenseMatrix< OrdinalType, ScalarType > & | Source | ) | [inline] |
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 656 of file Teuchos_SerialDenseMatrix.hpp.
SerialDenseMatrix< OrdinalType, ScalarType > & Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::operator= | ( | const SerialDenseMatrix< OrdinalType, ScalarType > & | Source | ) | [inline] |
Copies values from one matrix to another.
The operator= copies the values from one existing SerialDenseMatrix 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 585 of file Teuchos_SerialDenseMatrix.hpp.
bool Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::operator== | ( | const SerialDenseMatrix< OrdinalType, ScalarType > & | Operand | ) | [inline] |
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 789 of file Teuchos_SerialDenseMatrix.hpp.
const ScalarType * Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::operator[] | ( | OrdinalType | colIndex | ) | const [inline] |
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. Reimplemented in Teuchos::SerialDenseVector< OrdinalType, ScalarType >.
Definition at line 706 of file Teuchos_SerialDenseMatrix.hpp.
ScalarType * Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::operator[] | ( | OrdinalType | colIndex | ) | [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. Reimplemented in Teuchos::SerialDenseVector< OrdinalType, ScalarType >.
Definition at line 715 of file Teuchos_SerialDenseMatrix.hpp.
void Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::print | ( | std::ostream & | os | ) | const [inline, virtual] |
Print method. Defines the behavior of the std::ostream << operator inherited from the Object class.
Reimplemented from Teuchos::Object.
Reimplemented in Teuchos::SerialDenseVector< OrdinalType, ScalarType >.
Definition at line 912 of file Teuchos_SerialDenseMatrix.hpp.
int Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::putScalar | ( | const ScalarType | value = Teuchos::ScalarTraits<ScalarType>::zero() |
) | [inline] |
Set all values in the matrix to a constant value.
value | - Value to use; zero if none specified. |
Definition at line 556 of file Teuchos_SerialDenseMatrix.hpp.
int Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::random | ( | ) | [inline] |
Set all values in the matrix to be random numbers.
Definition at line 570 of file Teuchos_SerialDenseMatrix.hpp.
int Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::reshape | ( | OrdinalType | numRows, | |
OrdinalType | numCols | |||
) | [inline] |
Reshaping method for changing the size of a SerialDenseMatrix, keeping the entries.
numRows | - The number of rows in this matrix. | |
numCols | - The number of columns in this matrix. |
Definition at line 524 of file Teuchos_SerialDenseMatrix.hpp.
int Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::scale | ( | const SerialDenseMatrix< OrdinalType, ScalarType > & | A | ) | [inline] |
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::SerialDenseMatrix used to perform element-wise scaling of this. |
Definition at line 845 of file Teuchos_SerialDenseMatrix.hpp.
int Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::scale | ( | const ScalarType | alpha | ) | [inline] |
Scale this
matrix by alpha
; *this
= alpha*
*this
.
alpha | Scalar to multiply this by. |
Definition at line 831 of file Teuchos_SerialDenseMatrix.hpp.
int Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::shape | ( | OrdinalType | numRows, | |
OrdinalType | numCols | |||
) | [inline] |
Shape method for changing the size of a SerialDenseMatrix, initializing entries to zero.
numRows | - The number of rows in this matrix. | |
numCols | - The number of columns in this matrix. |
Definition at line 495 of file Teuchos_SerialDenseMatrix.hpp.
int Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::shapeUninitialized | ( | OrdinalType | numRows, | |
OrdinalType | numCols | |||
) | [inline] |
Same as shape()
except leaves uninitialized.
Definition at line 510 of file Teuchos_SerialDenseMatrix.hpp.
OrdinalType Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::stride | ( | ) | const [inline] |
Returns the stride between the columns of this matrix in memory.
Definition at line 347 of file Teuchos_SerialDenseMatrix.hpp.
ScalarType* Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::values | ( | ) | const [inline] |
Data array access method.
Definition at line 246 of file Teuchos_SerialDenseMatrix.hpp.
OrdinalType Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::numCols_ [protected] |
Definition at line 380 of file Teuchos_SerialDenseMatrix.hpp.
OrdinalType Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::numRows_ [protected] |
Definition at line 379 of file Teuchos_SerialDenseMatrix.hpp.
OrdinalType Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::stride_ [protected] |
Definition at line 381 of file Teuchos_SerialDenseMatrix.hpp.
ScalarType* Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::values_ [protected] |
Definition at line 383 of file Teuchos_SerialDenseMatrix.hpp.
bool Teuchos::SerialDenseMatrix< OrdinalType, ScalarType >::valuesCopied_ [protected] |
Definition at line 382 of file Teuchos_SerialDenseMatrix.hpp.