Encapsulates lower triangular matrices, which are zero above the diagonal.
More...
#include <rw/lapack/ltrimat.h>
|
| RWLowerTriMat () |
|
| RWLowerTriMat (const RWLowerTriMat< TypeT > &A) |
|
| RWLowerTriMat (unsigned n, unsigned nAgain) |
|
| RWLowerTriMat (const RWMathVec< TypeT > &data, unsigned n, unsigned nAgain) |
|
| RWLowerTriMat (const typename rw_linear_algebra_traits< TypeT >::narrow_lower_tri_mat &re) |
|
| RWLowerTriMat (const RWLowerTriMat< double > &re, const RWLowerTriMat< double > &im) |
|
RWRORef< TypeT > | bcref (int i, int j) |
|
TypeT | bcset (int i, int j, TypeT x) |
|
TypeT | bcval (int i, int j) const |
|
unsigned | binaryStoreSize () const |
|
unsigned | cols () const |
|
RWLowerTriMat< TypeT > | copy () const |
|
TypeT * | data () |
|
const RWMathVec< TypeT > & | dataVec () const |
|
RWLowerTriMat< TypeT > | deepCopy () const |
|
void | deepenShallowCopy () |
|
RWLowerTriMat< TypeT > | leadingSubmatrix (int k) |
|
bool | operator!= (const RWLowerTriMat< TypeT > &X) |
|
RWRORef< TypeT > | operator() (int i, int j) |
|
TypeT | operator() (int i, int j) const |
|
RWLowerTriMat< TypeT > & | operator*= (const RWLowerTriMat< TypeT > &m) |
|
RWLowerTriMat< TypeT > & | operator*= (TypeT) |
|
RWLowerTriMat< TypeT > & | operator+= (const RWLowerTriMat< TypeT > &m) |
|
RWLowerTriMat< TypeT > & | operator-= (const RWLowerTriMat< TypeT > &m) |
|
RWLowerTriMat< TypeT > & | operator/= (TypeT) |
|
RWLowerTriMat< TypeT > & | operator= (const RWLowerTriMat< TypeT > &A) |
|
bool | operator== (const RWLowerTriMat< TypeT > &X) |
|
void | printOn (std::ostream &) const |
|
RWRORef< TypeT > | ref (int i, int j) |
|
RWLowerTriMat< TypeT > & | reference (RWLowerTriMat< TypeT > &m) |
|
void | resize (unsigned m, unsigned n) |
|
void | restoreFrom (RWvistream &) |
|
void | restoreFrom (RWFile &) |
|
unsigned | rows () const |
|
void | saveOn (RWvostream &) const |
|
void | saveOn (RWFile &) const |
|
void | scanFrom (std::istream &) |
|
TypeT | set (int i, int j, TypeT x) |
|
TypeT | val (int i, int j) const |
|
void | zero () |
|
|
(Note that these are not member functions.)
|
template<class TypeT > |
RWLowerTriMat< typename rw_numeric_traits< TypeT >::norm_type > | abs (const RWLowerTriMat< TypeT > &A) |
|
RWLowerTriMat< double > | arg (const RWLowerTriMat< DComplex > &A) |
|
RWLowerTriMat< DComplex > | conj (const RWLowerTriMat< DComplex > &A) |
|
RWLowerTriMat< double > | imag (const RWLowerTriMat< DComplex > &A) |
|
template<class TypeT > |
TypeT | maxValue (const RWLowerTriMat< TypeT > &A) |
|
template<class TypeT > |
TypeT | minValue (const RWLowerTriMat< TypeT > &A) |
|
RWLowerTriMat< double > | norm (const RWLowerTriMat< DComplex > &A) |
|
template<class TypeT > |
RWLowerTriMat< TypeT > | operator* (const RWLowerTriMat< TypeT > &, const RWLowerTriMat< TypeT > &) |
|
template<class TypeT > |
RWLowerTriMat< TypeT > | operator* (const RWLowerTriMat< TypeT > &A, TypeT x) |
|
template<class TypeT > |
RWLowerTriMat< TypeT > | operator* (TypeT x, const RWLowerTriMat< TypeT > &A) |
|
template<class TypeT > |
RWLowerTriMat< TypeT > | operator+ (const RWLowerTriMat< TypeT > &) |
|
template<class TypeT > |
RWLowerTriMat< TypeT > | operator+ (const RWLowerTriMat< TypeT > &, const RWLowerTriMat< TypeT > &) |
|
template<class TypeT > |
RWLowerTriMat< TypeT > | operator- (const RWLowerTriMat< TypeT > &) |
|
template<class TypeT > |
RWLowerTriMat< TypeT > | operator- (const RWLowerTriMat< TypeT > &, const RWLowerTriMat< TypeT > &) |
|
template<class TypeT > |
RWLowerTriMat< TypeT > | operator/ (const RWLowerTriMat< TypeT > &, const RWLowerTriMat< TypeT > &) |
|
template<class TypeT > |
RWLowerTriMat< TypeT > | operator/ (const RWLowerTriMat< TypeT > &A, TypeT x) |
|
template<class TypeT > |
std::ostream & | operator<< (std::ostream &s, const RWLowerTriMat< TypeT > &m) |
|
template<class TypeT > |
std::istream & | operator>> (std::istream &s, RWLowerTriMat< TypeT > &m) |
|
template<class TypeT > |
RWMathVec< TypeT > | product (const RWLowerTriMat< TypeT > &A, const RWMathVec< TypeT > &x) |
|
template<class TypeT > |
RWMathVec< TypeT > | product (const RWMathVec< TypeT > &x, const RWLowerTriMat< TypeT > &A) |
|
RWLowerTriMat< double > | real (const RWLowerTriMat< DComplex > &A) |
|
template<class TypeT > |
RWLowerTriMat< TypeT > | toLowerTriMat (const RWGenMat< TypeT > &A) |
|
template<class TypeT > |
RWUpperTriMat< TypeT > | transpose (const RWLowerTriMat< TypeT > &) |
|
template<class TypeT>
class RWLowerTriMat< TypeT >
A lower triangular matrix is 0 above the diagonal. The class RWLowerTriMat<T> encapsulates lower triangular matrices.
- Synopsis
#include <rw/lapack/ltrimat.h>
- Example
#include <rw/lapack/ltrimat.h>
int main()
{
L.leadingSubmatrix(2).zero();
return 0;
}
- Storage Scheme
The matrix is stored row by row. For example, the matrix:
\[ \begin{bmatrix} A_{11} & 0 & 0 & ... & 0 \\ A_{12} & A_{22} & 0 & ... & 0 \\ A_{13} & A_{23} & A_{33} & ... & 0 \\ . & & & & \\ . & & & & \\ . & & & & \\ A_{1n} & A_{2n} & A_{3n} & ... & A_{nn} \\ \end{bmatrix} \]
is stored as follows:
[ A11 A12 A22 A13 A23 A33 ... A1n A2n A3n ... Ann ]
The mapping between the array and storage vector is as follows:
\[ A(i+1,j+1) \to vec[i(i+1)/2+j] \]
Default constructor. Builds a matrix of size 0 x 0. This constructor is necessary to declare a matrix with no explicit constructor or to declare an array of matrices.
Builds a copy of its argument, A. Note that the new matrix references A's data. To construct a matrix with its own copy of the data, use either the copy() or deepenShallowCopy() member functions.
Defines an uninitialized matrix of size n x nAgain. Both arguments must be equal or a runtime error occurs. This constructor is used, rather than a constructor that takes only a single argument, to avoid type conversion problems.
Constructs a size n x nAgain matrix using the data in the passed vector. This data must be stored in the format described in the Storage Scheme section. The resultant matrix references the data in vector data.
Constructs a complex matrix from the real part supplied. The imaginary part is assumed to be 0.
Constructs a complex matrix from the real and imaginary parts supplied. If no imaginary part is supplied, it is assumed to be 0.
Returns a reference to the ijth element of the matrix, after doing bounds checking.
Sets the ijth element of the matrix equal to x, after doing bounds checking.
Returns the value of the ijth element of the matrix, after doing bounds checking.
Returns the number of bytes that it would take to write the matrix to a file using saveOn().
Returns the number of columns in the matrix.
Creates a copy of this matrix with distinct data. The stride of the data vector in the new matrix is guaranteed to be 1.
Returns a pointer to the first item of data in the vector storing the matrix's data. You can use this (with caution!) to pass the matrix's data to C or FORTRAN subroutines. Be aware that the stride of the data vector may not be 1.
Returns the matrix's data vector. This is where the explicitly stored entries in the matrix are kept.
Creates a copy of this matrix with distinct data. The stride of the data vector in the new matrix is guaranteed to be 1.
Ensures that the data in the matrix is not shared by any other matrix or vector. Also ensures that the stride in the data vector is equal to 1. If necessary, a new copy of the data vector is made.
Returns the k x k upper left corner of the matrix. The submatrix and the matrix share the same data.
Boolean operators. Two matrices are considered equal if they have the same size and their elements are all exactly the same. Be aware that floating point arithmetic is not exact; matrices that are theoretically equal are not always numerically equal.
Accesses the ijth element. If the matrix is not a const
matrix, a reference type is returned, so this operator can be used for assigning or accessing an element. In this case, using this operator is equivalent to calling the ref() member function. If the matrix is a const
matrix, a value is returned, so this operator can be used only for accessing an element. In this case, using this operator is equivalent to calling the val() member function. Bounds checking is done if the preprocessor symbol RWBOUNDS_CHECK
is defined before including the header file.
Accesses the ijth element. If the matrix is not a const
matrix, a reference type is returned, so this operator can be used for assigning or accessing an element. In this case, using this operator is equivalent to calling the ref() member function. If the matrix is a const
matrix, a value is returned, so this operator can be used only for accessing an element. In this case, using this operator is equivalent to calling the val() member function. Bounds checking is done if the preprocessor symbol RWBOUNDS_CHECK
is defined before including the header file.
Performs element-by-element arithmetic on the data in the matrix. In particular, note that operator*=() does element-by-element multiplication, not inner-product style matrix multiplication. You can use the product() global function to do matrix-matrix inner product multiplication.
Performs the indicated operation on each element of the matrix.
Performs element-by-element arithmetic on the data in the matrix.
Performs element-by-element arithmetic on the data in the matrix.
Performs the indicated operation on each element of the matrix.
Sets the matrix elements equal to the elements of A. The two matrices must be the same size. To make the matrix reference the same data as A, use the reference() member function.
Boolean operators. Two matrices are considered equal if they have the same size and their elements are all exactly the same. Be aware that floating point arithmetic is not exact; matrices that are theoretically equal are not always numerically equal.
Prints the matrix to an output stream in human readable format.
Returns a reference to the ijth element of the matrix. Bounds checking is done if the preprocessor symbol RWBOUNDS_CHECK
is defined when the header file is read. The member function bcref() does the same thing with guaranteed bounds checking.
Makes this matrix a reference to the argument matrix. The two matrices share the same data. The matrices do not have to be the same size before calling reference(). To copy a matrix into another of the same size, you can use the operator=() member operator.
Resizes the matrix. Any new entries in the matrix are set to 0. Both arguments must be the same.
Reads in a matrix from an RWvistream, the Rogue Wave virtual input stream class. The matrix must have been stored to the stream using the saveOn() member function.
Reads in a matrix from an RWFile. The matrix must have been stored to the file using the saveOn() member function.
Returns the number of rows in the matrix.
Stores a matrix to an RWvostream, the Rogue Wave virtual output stream class. The matrix can be read using the restoreFrom() member function.
Reads a matrix from an input stream. The format of the matrix is the same as the format output by the printOn() member function. Below is a sample matrix that could be input. Note that extra white space and any text preceding the dimension specification are ignored. Only the lower triangle of the matrix is used.
3x3
[ 4 0 0
-5 9 0
-7 -5 3
]
Sets the ijth element of the matrix equal to x. Bounds checking is done if the preprocessor symbol RWBOUNDS_CHECK
is defined when the header file is read. The member function bcset() does the same thing with guaranteed bounds checking.
Returns the value of the ijth element of the matrix. Bounds checking is done if the preprocessor symbol RWBOUNDS_CHECK
is defined when the header file is read. The member function bcval() does the same thing with guaranteed bounds checking.
Sets every element of the matrix to 0.
Returns a matrix whose entries are the absolute value of the argument. The absolute value of a complex number is considered to be the sum of the absolute values of its real and imaginary parts. To get the norm of a complex matrix, you can use the norm() function.
Returns a matrix where each element is the argument of the corresponding element in the matrix A.
Returns a matrix where each element is the complex conjugate of the corresponding element in the matrix A.
Returns a matrix where each element is the imaginary part of the corresponding element in the matrix A.
Returns the maximum entry in the matrix.
Returns the minimum entry in the matrix.
Returns a matrix where each element is the norm (magnitude) of the corresponding element in the matrix A.
Performs element-by-element operations on the arguments. To do inner product matrix multiplication, you can use the product() global function.
Performs element-by-element operations on the arguments.
Performs element-by-element operations on the arguments.
Unary plus operator. Returns a copy of the matrix.
Performs element-by-element operations on the arguments.
Unary minus operator. Returns a copy of the negation of the matrix.
Performs element-by-element operations on the arguments.
Performs element-by-element operations on the arguments.
Performs element-by-element operations on the arguments.
template<class TypeT >
std::ostream & operator<< |
( |
std::ostream & |
s, |
|
|
const RWLowerTriMat< TypeT > & |
m |
|
) |
| |
|
related |
template<class TypeT >
std::istream & operator>> |
( |
std::istream & |
s, |
|
|
RWLowerTriMat< TypeT > & |
m |
|
) |
| |
|
related |
Returns the inner product (matrix-vector product) of A and x.
Returns the inner product (matrix-vector product) of x and A. This is equal to the product of A transpose and x.
Returns a matrix where each element is the real part of the corresponding element in the matrix A.
Extracts the lower triangular part of a square matrix.
Returns the transpose of the argument matrix. The returned matrix references the same data as the argument matrix.