SourcePro® 2024.1 |
SourcePro® API Reference Guide |
Encapsulates skew symmetric matrices. More...
#include <rw/lapack/skewmat.h>
Public Member Functions | |
RWSkewMat () | |
RWSkewMat (const RWMathVec< TypeT > &data, unsigned n, unsigned nAgain) | |
RWSkewMat (const RWSkewMat< double > &re, const RWSkewMat< double > &im) | |
RWSkewMat (const RWSkewMat< TypeT > &A) | |
RWSkewMat (unsigned n, unsigned nAgain) | |
RWNGRef< 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 |
RWSkewMat< TypeT > | copy () const |
TypeT * | data () |
const RWMathVec< TypeT > & | dataVec () const |
RWSkewMat< TypeT > | deepCopy () const |
void | deepenShallowCopy () |
RWSkewMat< TypeT > | leadingSubmatrix (int k) |
bool | operator!= (const RWSkewMat< TypeT > &X) |
RWNGRef< TypeT > | operator() (int i, int j) |
TypeT | operator() (int i, int j) const |
RWSkewMat< TypeT > & | operator*= (const RWSkewMat< TypeT > &m) |
RWSkewMat< TypeT > & | operator*= (TypeT) |
RWSkewMat< TypeT > & | operator+= (const RWSkewMat< TypeT > &m) |
RWSkewMat< TypeT > & | operator-= (const RWSkewMat< TypeT > &m) |
RWSkewMat< TypeT > & | operator/= (const RWSkewMat< TypeT > &m) |
RWSkewMat< TypeT > & | operator/= (TypeT) |
RWSkewMat< TypeT > & | operator= (const RWSkewMat< TypeT > &A) |
bool | operator== (const RWSkewMat< TypeT > &X) |
void | printOn (std::ostream &) const |
RWNGRef< TypeT > | ref (int i, int j) |
RWSkewMat< TypeT > & | reference (RWSkewMat< TypeT > &m) |
void | resize (unsigned m, unsigned n) |
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) |
TypeT | val (int i, int j) const |
void | zero () |
Related Symbols | |
(Note that these are not member symbols.) | |
template<class TypeT > | |
RWSymMat< typename rw_numeric_traits< TypeT >::norm_type > | abs (const RWSkewMat< TypeT > &A) |
RWSkewMat< double > | imag (const RWSkewMat< DComplex > &A) |
RWSymMat< double > | norm (const RWSkewMat< DComplex > &A) |
template<class TypeT > | |
RWSkewMat< TypeT > | operator* (const RWSkewMat< TypeT > &, const RWSkewMat< TypeT > &) |
template<class TypeT > | |
RWSkewMat< TypeT > | operator* (const RWSkewMat< TypeT > &A, TypeT x) |
template<class TypeT > | |
RWSkewMat< TypeT > | operator* (TypeT x, const RWSkewMat< TypeT > &A) |
template<class TypeT > | |
RWSkewMat< TypeT > | operator+ (const RWSkewMat< TypeT > &) |
template<class TypeT > | |
RWSkewMat< TypeT > | operator+ (const RWSkewMat< TypeT > &, const RWSkewMat< TypeT > &) |
template<class TypeT > | |
RWSkewMat< TypeT > | operator- (const RWSkewMat< TypeT > &) |
template<class TypeT > | |
RWSkewMat< TypeT > | operator- (const RWSkewMat< TypeT > &, const RWSkewMat< TypeT > &) |
template<class TypeT > | |
RWSkewMat< TypeT > | operator/ (const RWSkewMat< TypeT > &, const RWSkewMat< TypeT > &) |
template<class TypeT > | |
RWSkewMat< TypeT > | operator/ (const RWSkewMat< TypeT > &A, TypeT x) |
template<class TypeT > | |
RWSkewMat< TypeT > | operator/ (TypeT x, const RWSkewMat< TypeT > &A) |
template<class TypeT > | |
std::ostream & | operator<< (std::ostream &s, const RWSkewMat< TypeT > &m) |
template<class TypeT > | |
std::istream & | operator>> (std::istream &s, RWSkewMat< TypeT > &m) |
template<class TypeT > | |
RWMathVec< TypeT > | product (const RWMathVec< TypeT > &x, const RWSkewMat< TypeT > &A) |
template<class TypeT > | |
RWMathVec< TypeT > | product (const RWSkewMat< TypeT > &A, const RWMathVec< TypeT > &x) |
RWSkewMat< double > | real (const RWSkewMat< DComplex > &A) |
template<class TypeT > | |
RWSkewMat< TypeT > | toSkewMat (const RWGenMat< TypeT > &A, bool keepMainDiag=true) |
template<class TypeT > | |
RWSkewMat< TypeT > | transpose (const RWSkewMat< TypeT > &) |
The class RWSkewMat encapsulates skew symmetric matrices. A skew symmetric matrix is defined by the requirement that Aij = -Aji. This strict definition implies that the diagonal entries must be 0. This requirement is relaxed by the Rogue Wave skew symmetric matrix classes, which require only that Aij = -Aji for the off-diagonal elements; in other words, the diagonal need not be 0. Skew symmetric matrices with nonzero diagonals are sometimes useful, for example, as rotation matrices in computer graphics applications.
The upper triangle of the matrix is stored in column major order. The lower triangle is then calculated implicitly.
\[ \begin{bmatrix} A_{11} & A_{12} & A_{12} & ... & A_{1n} \\ -A_{12} & A_{22} & A_{23} & ... & A_{2n} \\ -A_{13} & -A_{23} & A_{33} & ... & A_{3n} \\ . & & & & \\ . & & & & \\ . & & & & \\ A_{1n} & A_{2n} & A_{3n} & ... & A_{nn} \\ \end{bmatrix} \]
The data is stored in the following order:
[ 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 \left\{ \begin{array}{l l} \text{vec}[j(j+1)/ 2+i] & \quad \text{if } i \leq j \\ \text{-vec}[i(i+1)/ 2+j] & \quad \text{if } j \leq i \\ \end{array} \right. \]
RWSkewMat< TypeT >::RWSkewMat | ( | ) |
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.
RWSkewMat< TypeT >::RWSkewMat | ( | const RWSkewMat< TypeT > & | A | ) |
Build 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.
RWSkewMat< TypeT >::RWSkewMat | ( | unsigned | n, |
unsigned | nAgain ) |
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.
RWSkewMat< TypeT >::RWSkewMat | ( | const RWMathVec< TypeT > & | data, |
unsigned | n, | ||
unsigned | nAgain ) |
Constructs a size n x nAgain matrix using the data in the passed vector. Arguments n and nAgain must be equal or a runtime error occurs. This data must be stored in the format described in the Storage Scheme section. The resultant matrix references the data in vector data.
RWSkewMat< TypeT >::RWSkewMat | ( | const RWSkewMat< double > & | re, |
const RWSkewMat< double > & | im ) |
Constructs a complex matrix from the real and imaginary parts supplied.
Returns a reference to the ij th element of the matrix, after doing bounds checking.
TypeT RWSkewMat< TypeT >::bcset | ( | int | i, |
int | j, | ||
TypeT | x ) |
Sets the ij th element of the matrix equal to x, after doing bounds checking.
TypeT RWSkewMat< TypeT >::bcval | ( | int | i, |
int | j ) const |
Returns the value of the ij th element of the matrix, after doing bounds checking.
unsigned RWSkewMat< TypeT >::binaryStoreSize | ( | ) | const |
Returns the number of bytes that it would take to write the matrix to a file using saveOn().
|
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. 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.
|
inline |
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.
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.
References the ij th element. This operator is equivalent to calling the ref() 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. 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.
RWSkewMat< TypeT > & RWSkewMat< TypeT >::operator*= | ( | const RWSkewMat< TypeT > & | m | ) |
Performs element-by-element arithmetic on the data in the matrices.
Performs the indicated operation on each element of the matrix.
RWSkewMat< TypeT > & RWSkewMat< TypeT >::operator+= | ( | const RWSkewMat< TypeT > & | m | ) |
Performs element-by-element arithmetic on the data in the matrices.
RWSkewMat< TypeT > & RWSkewMat< TypeT >::operator-= | ( | const RWSkewMat< TypeT > & | m | ) |
Performs element-by-element arithmetic on the data in the matrices.
RWSkewMat< TypeT > & RWSkewMat< TypeT >::operator/= | ( | const RWSkewMat< TypeT > & | m | ) |
Performs element-by-element arithmetic on the data in the matrices.
Performs the indicated operation on each element of the matrix.
RWSkewMat< TypeT > & RWSkewMat< TypeT >::operator= | ( | const RWSkewMat< TypeT > & | A | ) |
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.
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.
void RWSkewMat< 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 RWSkewMat< TypeT >::resize | ( | unsigned | m, |
unsigned | n ) |
Resizes the matrix. Any new entries in the matrix are set to 0. Both arguments must be the same.
void RWSkewMat< 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() 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() member function.
void RWSkewMat< 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() member function.
void RWSkewMat< 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. 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 skew symmetric part 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 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 imaginary part of the corresponding element in the matrix A.
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, you can 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 operator. Returns a copy of the matrix.
|
related |
Performs element-by-element operations on the arguments.
Unary minus operator. Returns a copy of the matrix's negation.
|
related |
Performs element-by-element operations on the arguments.
|
related |
Performs element-by-element operations on the arguments.
|
related |
Performs element-by-element operations on the arguments.
|
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-vector product) of x and A. This is equal to the product of A transpose and x.
|
related |
Returns the inner product (matrix-vector product) of A and x.
Returns a matrix where each element is the real part of the corresponding element in the matrix A.
|
related |
Extracts the skew symmetric part of a square matrix. The skew symmetric part of a matrix A is (A-AT)/2
. If the argument keepMainDiag is set to true
(as is the default) then the main diagonal of A is kept, even though it should be 0 according to the strict mathematical definition of skew-symmetry.
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |