SourcePro® 2024.1 |
SourcePro® API Reference Guide |
Encapsulates a banded matrix. More...
#include <rw/lapack/bandmat.h>
Public Member Functions | |
RWBandMat () | |
RWBandMat (const RWBandMat< double > &re, const RWBandMat< double > &im) | |
RWBandMat (const RWBandMat< TypeT > &A) | |
RWBandMat (const RWHermBandMat< TypeT > &A) | |
RWBandMat (const RWMathVec< TypeT > &data, unsigned n, unsigned nAgain, unsigned lowerWidth, unsigned upperWdth) | |
RWBandMat (const RWSymBandMat< TypeT > &A) | |
RWBandMat (const RWTriDiagMat< TypeT > &A) | |
RWBandMat (unsigned n, unsigned nAgain, unsigned lowerWidth, unsigned upperWidth) | |
unsigned | bandwidth () const |
RWMathVec< TypeT > | bcdiagonal (int j=0) const |
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 |
RWBandMat< TypeT > | copy () const |
TypeT * | data () |
RWMathVec< TypeT > | dataVec () |
RWBandMat< TypeT > | deepCopy () const |
void | deepenShallowCopy () |
RWMathVec< TypeT > | diagonal (int i=0) const |
RWBandMat< TypeT > | leadingSubmatrix (int order) |
unsigned | lowerBandwidth () const |
bool | operator!= (const RWBandMat< TypeT > &X) |
RWRORef< TypeT > | operator() (int i, int j) |
TypeT | operator() (int i, int j) const |
RWBandMat< TypeT > & | operator*= (const RWBandMat< TypeT > &m) |
RWBandMat< TypeT > & | operator*= (TypeT) |
RWBandMat< TypeT > & | operator+= (const RWBandMat< TypeT > &m) |
RWBandMat< TypeT > & | operator-= (const RWBandMat< TypeT > &m) |
RWBandMat< TypeT > & | operator/= (const RWBandMat< TypeT > &m) |
RWBandMat< TypeT > & | operator/= (TypeT) |
RWBandMat< TypeT > & | operator= (const RWBandMat< TypeT > &m) |
bool | operator== (const RWBandMat< TypeT > &X) |
void | printOn (std::ostream &) const |
RWRORef< TypeT > | ref (int i, int j) |
RWBandMat< TypeT > & | reference (RWBandMat< TypeT > &m) |
void | resize (unsigned m, unsigned n) |
void | resize (unsigned n, unsigned nAgain, unsigned lowWidth, unsigned upWidth) |
void | restoreFrom (RWFile &) |
void | restoreFrom (RWvistream &) |
unsigned | rows () const |
void | saveOn (RWFile &) const |
void | saveOn (RWvostream &) const |
void | scanFrom (std::istream &) |
TypeT | set (int i, int j, TypeT x) |
unsigned | upperBandwidth () const |
TypeT | val (int i, int j) const |
void | zero () |
Related Symbols | |
(Note that these are not member symbols.) | |
template<class TypeT > | |
RWBandMat< typename rw_numeric_traits< TypeT >::norm_type > | abs (const RWBandMat< TypeT > &M) |
RWBandMat< double > | arg (const RWBandMat< DComplex > &A) |
RWBandMat< DComplex > | conj (const RWBandMat< DComplex > &A) |
RWBandMat< DComplex > | conjTransposeProduct (const RWBandMat< DComplex > &A, const RWBandMat< DComplex > &B) |
RWBandMat< double > | imag (const RWBandMat< DComplex > &A) |
template<class TypeT > | |
TypeT | maxValue (const RWBandMat< TypeT > &A) |
template<class TypeT > | |
TypeT | minValue (const RWBandMat< TypeT > &A) |
RWBandMat< double > | norm (const RWBandMat< DComplex > &A) |
template<class TypeT > | |
RWBandMat< TypeT > | operator* (const RWBandMat< TypeT > &, const RWBandMat< TypeT > &) |
template<class TypeT > | |
RWBandMat< TypeT > | operator* (const RWBandMat< TypeT > &A, TypeT x) |
template<class TypeT > | |
RWBandMat< TypeT > | operator* (TypeT x, const RWBandMat< TypeT > &A) |
template<class TypeT > | |
RWBandMat< TypeT > | operator+ (const RWBandMat< TypeT > &) |
template<class TypeT > | |
RWBandMat< TypeT > | operator+ (const RWBandMat< TypeT > &, const RWBandMat< TypeT > &) |
template<class TypeT > | |
RWBandMat< TypeT > | operator- (const RWBandMat< TypeT > &) |
template<class TypeT > | |
RWBandMat< TypeT > | operator- (const RWBandMat< TypeT > &, const RWBandMat< TypeT > &) |
template<class TypeT > | |
RWBandMat< TypeT > | operator/ (const RWBandMat< TypeT > &, const RWBandMat< TypeT > &) |
template<class TypeT > | |
RWBandMat< TypeT > | operator/ (const RWBandMat< TypeT > &A, TypeT x) |
template<class TypeT > | |
std::ostream & | operator<< (std::ostream &s, const RWBandMat< TypeT > &m) |
template<class TypeT > | |
std::istream & | operator>> (std::istream &s, RWBandMat< TypeT > &m) |
template<class TypeT > | |
RWBandMat< TypeT > | product (const RWBandMat< TypeT > &A, const RWBandMat< TypeT > &B) |
template<class TypeT > | |
RWMathVec< TypeT > | product (const RWBandMat< TypeT > &A, const RWMathVec< TypeT > &x) |
template<class TypeT > | |
RWMathVec< TypeT > | product (const RWMathVec< TypeT > &x, const RWBandMat< TypeT > &A) |
RWBandMat< double > | real (const RWBandMat< DComplex > &A) |
template<class TypeT > | |
RWBandMat< TypeT > | toBandMat (const RWGenMat< TypeT > &A, unsigned bandl, unsigned bandu) |
template<class TypeT > | |
RWHermBandMat< TypeT > | toHermBandMat (const RWBandMat< TypeT > &A) |
template<class TypeT > | |
RWTriDiagMat< TypeT > | toTriDiagMat (const RWBandMat< TypeT > &A) |
template<class TypeT > | |
RWBandMat< TypeT > | transpose (const RWBandMat< TypeT > &A) |
template<class TypeT > | |
RWBandMat< TypeT > | transposeProduct (const RWBandMat< TypeT > &A, const RWBandMat< TypeT > &B) |
The class RWBandMat encapsulates a banded matrix. A banded matrix is nonzero only near the diagonal. Specifically, if u is the upper bandwidth and l the lower, the matrix entry Aij is defined as 0 if either j-i>u or i-j>l. The total bandwidth, simply called bandwidth, is the sum of the upper and lower bandwidths plus 1, for the diagonal. See the Storage Scheme section of this entry for an example of a banded matrix.
The matrix is stored column-by-column. There are some unused locations in the vector of data so that each column takes up the same number of entries. For example, the following 9x9 matrix has an upper bandwidth of 1, a lower bandwidth of 2, and thus a total bandwidth of 4:
\[ \begin{bmatrix} A_{11} & A_{12} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ A_{21} & A_{22} & A_{23} & 0 & 0 & 0 & 0 & 0 & 0 \\ A_{31} & A_{32} & A_{33} & A_{34} & 0 & 0 & 0 & 0 & 0 \\ 0 & A_{42} & A_{43} & A_{44} & A_{45} & 0 & 0 & 0 & 0 \\ 0 & 0 & A_{53} & A_{54} & A_{55} & A_{56} & 0 & 0 & 0 \\ 0 & 0 & 0 & A_{64} & A_{65} & A_{66} & A_{67} & 0 & 0 \\ 0 & 0 & 0 & 0 & A_{75} & A_{76} & A_{77} & A_{78} & 0 \\ 0 & 0 & 0 & 0 & 0 & A_{86} & A_{87} & A_{88} & A_{89} \\ 0 & 0 & 0 & 0 & 0 & 0 & A_{97} & A_{98} & A_{99} \end{bmatrix} \]
This matrix is stored as follows:
[ XXX A11 A21 A31 A12 A22 A32 A42 A23 A33 A43 A53 A34 A44 A54 A64 A45 A55 A65 A75 A56 A66 A76 A86 A67 A77 A87 A97 A78 A88 A98 XXX A89 A99 XXX XXX ]
where XXX
indicates an unused storage location. The mapping between array entry Aij and the storage vector is as follows:
\[ A[i + 1, j + 1] \to vec[i - j + upperBandwidth + j * bandwidth] \]
RWBandMat< TypeT >::RWBandMat | ( | ) |
Default constructor. Builds a matrix of size 0 by 0. Necessary for declaring a matrix with no explicit constructor, or an array of matrices.
RWBandMat< TypeT >::RWBandMat | ( | const RWBandMat< TypeT > & | A | ) |
Builds a copy of the 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.
RWBandMat< TypeT >::RWBandMat | ( | unsigned | n, |
unsigned | nAgain, | ||
unsigned | lowerWidth, | ||
unsigned | upperWidth ) |
Defines an uninitialized matrix of size n x nAgain with lower bandwidth lowerWidth and upper bandwidth upperWidth.
RWBandMat< TypeT >::RWBandMat | ( | const RWMathVec< TypeT > & | data, |
unsigned | n, | ||
unsigned | nAgain, | ||
unsigned | lowerWidth, | ||
unsigned | upperWdth ) |
Constructs a size n x nAgain matrix, with lower bandwidth lowerWidth and upper bandwidth upperWidth, 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.
RWBandMat< TypeT >::RWBandMat | ( | const RWTriDiagMat< TypeT > & | A | ) |
Constructs a banded matrix from a symmetric banded, Hermitian banded, or tridiagonal matrix.
RWBandMat< TypeT >::RWBandMat | ( | const RWSymBandMat< TypeT > & | A | ) |
Constructs a banded matrix from a symmetric banded, Hermitian banded, or tridiagonal matrix.
RWBandMat< TypeT >::RWBandMat | ( | const RWHermBandMat< TypeT > & | A | ) |
Constructs a banded matrix from a symmetric banded, Hermitian banded, or tridiagonal matrix.
RWBandMat< TypeT >::RWBandMat | ( | const RWBandMat< double > & | re, |
const RWBandMat< double > & | im ) |
Constructs a complex matrix from the real and imaginary parts supplied. If no imaginary part is supplied, it is assumed to be 0.
|
inline |
Returns the bandwidth of the matrix. The bandwidth is the sum of the upper and lower bandwidths plus 1 for the main diagonal.
Returns a reference to the j th diagonal of the matrix, after doing bounds checking. The main diagonal is indexed by 0, diagonals in the upper triangle are indexed with positive integers, and diagonals in the lower triangle are indexed with negative integers.
Returns a reference to the ij th element of the matrix, after doing bounds checking.
TypeT RWBandMat< TypeT >::bcset | ( | int | i, |
int | j, | ||
TypeT | x ) |
Sets the ij th element of the matrix equal to x, after doing bounds checking.
TypeT RWBandMat< TypeT >::bcval | ( | int | i, |
int | j ) const |
Returns the value of the ij th element of the matrix, after doing bounds checking.
unsigned RWBandMat< TypeT >::binaryStoreSize | ( | ) | const |
Returns the number of bytes that it would take to write the matrix to a file using saveOn(RWFile&) const.
|
inline |
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.
|
inline |
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, 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.
|
inline |
Ensures that the data in the matrix is not shared by any other matrix or vector. Also ensure that the stride in the data vector is equal to 1. If necessary, a new copy of the data vector is made.
Returns a reference to the i th diagonal of the matrix. The main diagonal is indexed by 0, diagonals in the upper triangle are indexed with positive integers, and diagonals in the lower triangle are indexed with negative integers. Bounds checking is done if the preprocessor symbol RWBOUNDS_CHECK
is defined when the header file is read. The member function bcdiagonal() does the same thing with guaranteed bounds checking.
Returns the order x order upper left corner of the matrix. The submatrix and the matrix share the same data.
|
inline |
Returns the lower bandwidth of the matrix.
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 which are theoretically equal are not always numerically equal.
Accesses the ij th 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 these cases, 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.
|
inline |
Accesses the ij th 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 these cases, 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.
RWBandMat< TypeT > & RWBandMat< TypeT >::operator*= | ( | const RWBandMat< TypeT > & | m | ) |
Performs element-by-element arithmetic on the data in the matrices.
Performs the indicated operation on each element of the matrix.
RWBandMat< TypeT > & RWBandMat< TypeT >::operator+= | ( | const RWBandMat< TypeT > & | m | ) |
Performs element-by-element arithmetic on the data in the matrices.
RWBandMat< TypeT > & RWBandMat< TypeT >::operator-= | ( | const RWBandMat< TypeT > & | m | ) |
Performs element-by-element arithmetic on the data in the matrices.
RWBandMat< TypeT > & RWBandMat< TypeT >::operator/= | ( | const RWBandMat< TypeT > & | m | ) |
Performs element-by-element arithmetic on the data in the matrices.
Performs the indicated operation on each element of the matrix.
RWBandMat< TypeT > & RWBandMat< TypeT >::operator= | ( | const RWBandMat< TypeT > & | m | ) |
Sets the matrix elements equal to the elements of m. The two matrices must be the same size. To make the matrix reference the same data as m, 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 which are theoretically equal are not always numerically equal.
void RWBandMat< TypeT >::printOn | ( | std::ostream & | ) | const |
Prints the matrix to an output stream in human readable format.
Returns a reference to the ij th 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, use the operator=() member operator.
void RWBandMat< TypeT >::resize | ( | unsigned | m, |
unsigned | n ) |
Resizes the matrix or changes both its size and lower and upper bandwidths. Any new entries in the matrix are set to 0.
void RWBandMat< TypeT >::resize | ( | unsigned | n, |
unsigned | nAgain, | ||
unsigned | lowWidth, | ||
unsigned | upWidth ) |
Resizes the matrix or changes both its size and lower and upper bandwidths. Any new entries in the matrix are set to 0.
Reads in a matrix from an RWFile. The matrix must have been stored to the file using the saveOn(RWFile&) const member function.
void RWBandMat< TypeT >::restoreFrom | ( | RWvistream & | ) |
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(RWvostream&) const member function.
|
inline |
Returns the number of rows in the matrix.
Stores a matrix to an RWFile. The matrix can be read using the restoreFrom(RWFile&) member function.
void RWBandMat< TypeT >::saveOn | ( | RWvostream & | ) | const |
Stores a matrix to an RWvostream, the Rogue Wave virtual output stream class. The matrix can be read using the restoreFrom(RWvistream&) member function.
void RWBandMat< TypeT >::scanFrom | ( | std::istream & | ) |
Reads a matrix from an input stream. The format of the matrix is the same as the format output by the printOn() member function: first the lower bandwidth, followed by the upper bandwidth, followed by the matrix itself. The sample matrix below shows the format. Note that extra white space and text preceding the bandwidth specification are ignored. Only the relevant band of the matrix is used.
|
inline |
Sets the ij th 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.
|
inline |
Returns the upper bandwidth of the matrix.
|
inline |
Returns the value of the ij th 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.
|
inline |
Sets every element of the matrix to 0.
|
related |
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.
|
related |
Returns the inner product (matrix product) of the complex conjugate transpose of A and the matrix B. This product is a banded matrix whose lower bandwidth is the sum of the upper bandwidth of A and the lower bandwidth of B, and whose upper bandwidth is the sum of the lower bandwidth of A and the upper bandwidth of B.
Returns a matrix where each element is the imaginary part of the corresponding element in the matrix A.
|
related |
Returns the maximum entry in the matrix.
|
related |
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.
|
related |
Performs element-by-element operations on the arguments. To do inner product matrix multiplication, use the product global function.
|
related |
Performs element-by-element operations on the arguments.
|
related |
Performs element-by-element operations on the arguments.
Unary plus and minus operators. Each operator returns a copy of the matrix or its negation.
|
related |
Performs element-by-element operations on the arguments. To do inner product matrix multiplication, use the product global function.
Unary plus and minus operators. Each operator returns a copy of the matrix or its negation.
|
related |
Performs element-by-element operations on the arguments. To do inner product matrix multiplication, use the product global function.
|
related |
Performs element-by-element operations on the arguments. To do inner product matrix multiplication, use the product global function.
|
related |
Performs element-by-element operations on the arguments.
|
related |
Writes the matrix to the stream. This is equivalent to calling the printOn() member function.
|
related |
Reads the matrix from the stream. This is equivalent to calling the scanFrom() member function.
|
related |
Returns the inner product (matrix product) of A and B. This product is a banded matrix whose lower bandwidth is the sum of the lower bandwidths of A and B, and whose upper bandwidth is the sum of the upper bandwidths of A and B.
|
related |
Returns the inner product (matrix-vector product) of A and x.
|
related |
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.
|
related |
Extracts a band of entries from a square matrix. The main diagonal is extracted, along with bandl diagonals from the upper triangle of the matrix, and bandu diagonals from the lower triangle of the matrix.
|
related |
Extracts the Hermitian part of a banded matrix. The Hermitian part of the banded matrix A is \( (A + conj( A^{T}))/2 \).
|
related |
Extracts the tridiagonal part of a general banded matrix. The tridiagonal part of matrix A consists of the main diagonal, the subdiagonal, and the superdiagonal.
Returns the transpose of the argument matrix.
|
related |
Returns the inner product (matrix product) of the transpose of A and the matrix B. This product is a banded matrix whose lower bandwidth is the sum of the upper bandwidth of A and the lower bandwidth of B, and whose upper bandwidth is the sum of the lower bandwidth of A and the upper bandwidth of B.
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |