SourcePro® 2024.1 |
SourcePro® API Reference Guide |
A templatized general matrix class. More...
#include <rw/math/genmat.h>
Inherits RWMatView.
Public Types | |
typedef RWGenMatConstIterator< T > | const_iterator |
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
typedef RWGenMatIterator< T > | iterator |
typedef rw_numeric_traits< T >::mathFunType | mathFunType |
typedef rw_numeric_traits< T >::mathFunType2 | mathFunType2 |
typedef rw_numeric_traits< T >::norm_type | norm_type |
typedef rw_numeric_traits< T >::promote_type | promote_type |
typedef std::reverse_iterator< iterator > | reverse_iterator |
Friends | |
RWGenMat< double > | imag (const RWGenMat< DComplex > &x) |
RWGenMat< double > | real (const RWGenMat< DComplex > &x) |
Related Symbols | |
(Note that these are not member symbols.) | |
RWGenMat< double > | abs (const RWGenMat< DComplex > &M) |
RWGenMat< double > | abs (const RWGenMat< double > &M) |
RWGenMat< float > | abs (const RWGenMat< float > &M) |
RWGenMat< int > | abs (const RWGenMat< int > &M) |
RWGenMat< signed char > | abs (const RWGenMat< signed char > &M) |
template<class T > | |
RWGenMat< T > | acos (const RWGenMat< T > &x) |
RWGenMat< double > | arg (const RWGenMat< DComplex > &x) |
template<class T > | |
RWGenMat< T > | asin (const RWGenMat< T > &x) |
template<class T > | |
RWGenMat< T > | atan (const RWGenMat< T > &x) |
template<class T > | |
RWGenMat< T > | atan2 (const RWGenMat< T > &x, const RWGenMat< T > &y) |
template<class T > | |
RWGenMat< T > | ceil (const RWGenMat< T > &x) |
RWGenMat< DComplex > | conj (const RWGenMat< DComplex > &x) |
RWGenMat< DComplex > | conjTransposeProduct (const RWGenMat< DComplex > &A, const RWGenMat< DComplex > &B) |
template<class T > | |
RWGenMat< T > | cos (const RWGenMat< T > &x) |
template<class T > | |
RWGenMat< T > | cosh (const RWGenMat< T > &x) |
template<class T > | |
T | determinant (const RWGenMat< T > &A) |
template<class T > | |
RWGenMat< T > | elementProduct (const RWGenMat< T > &A, const RWGenMat< T > &B) |
template<class T > | |
RWGenMat< T > | exp (const RWGenMat< T > &x) |
template<class T > | |
RWGenMat< T > | floor (const RWGenMat< T > &x) |
double | frobNorm (const RWGenMat< DComplex > &) |
double | frobNorm (const RWGenMat< double > &) |
float | frobNorm (const RWGenMat< float > &) |
double | l1Norm (const RWGenMat< DComplex > &) |
double | l1Norm (const RWGenMat< double > &) |
float | l1Norm (const RWGenMat< float > &) |
double | linfNorm (const RWGenMat< DComplex > &) |
double | linfNorm (const RWGenMat< double > &) |
float | linfNorm (const RWGenMat< float > &) |
template<class T > | |
RWGenMat< T > | log (const RWGenMat< T > &x) |
template<class T > | |
RWGenMat< T > | log10 (const RWGenMat< T > &x) |
template<class T > | |
void | maxIndex (const RWGenMat< T > &, int *i, int *j) |
double | maxNorm (const RWGenMat< DComplex > &) |
double | maxNorm (const RWGenMat< double > &) |
float | maxNorm (const RWGenMat< float > &) |
template<class T > | |
T | maxValue (const RWGenMat< T > &) |
template<class T > | |
T | mean (const RWGenMat< T > &x) |
template<class T > | |
void | minIndex (const RWGenMat< T > &, int *i, int *j) |
template<class T > | |
T | minValue (const RWGenMat< T > &) |
RWGenMat< double > | norm (const RWGenMat< DComplex > &x) |
template<class T > | |
RWGenMat< T > | operator% (const RWGenMat< T > &A, const RWGenMat< T > &B) |
template<class T > | |
RWMathVec< T > | operator% (const RWGenMat< T > &A, const RWMathVec< T > &x) |
template<class T > | |
RWMathVec< T > | operator% (const RWMathVec< T > &x, const RWGenMat< T > &A) |
template<class T > | |
RWGenMat< T > | operator* (const RWGenMat< T > &u, const RWGenMat< T > &v) |
template<class T > | |
RWGenMat< T > | operator* (const RWGenMat< T > &u, const T &s) |
template<class T > | |
RWGenMat< T > | operator* (const T &s, const RWGenMat< T > &v) |
template<class T > | |
RWGenMat< T > | operator+ (const RWGenMat< T > &u, const RWGenMat< T > &v) |
template<class T > | |
RWGenMat< T > | operator+ (const RWGenMat< T > &u, const T &s) |
template<class T > | |
RWGenMat< T > | operator+ (const RWGenMat< T > &v) |
template<class T > | |
RWGenMat< T > | operator+ (const T &s, const RWGenMat< T > &v) |
template<class T > | |
RWGenMat< T > | operator- (const RWGenMat< T > &u, const RWGenMat< T > &v) |
template<class T > | |
RWGenMat< T > | operator- (const RWGenMat< T > &u, const T &s) |
template<class T > | |
RWGenMat< T > | operator- (const RWGenMat< T > &v) |
template<class T > | |
RWGenMat< T > | operator- (const T &s, const RWGenMat< T > &v) |
template<class T > | |
RWGenMat< T > | operator/ (const RWGenMat< T > &u, const RWGenMat< T > &v) |
template<class T > | |
RWGenMat< T > | operator/ (const RWGenMat< T > &u, const T &s) |
template<class T > | |
RWGenMat< T > | operator/ (const T &s, const RWGenMat< T > &v) |
template<class T > | |
std::ostream & | operator<< (std::ostream &s, const RWGenMat< T > &m) |
template<class T > | |
std::istream & | operator>> (std::istream &s, RWGenMat< T > &v) |
template<class T > | |
RWGenMat< T > | pow (const RWGenMat< T > &x, const RWGenMat< T > &y) |
template<class T > | |
RWGenMat< T > | pow (const RWGenMat< T > &x, T y) |
template<class T > | |
RWGenMat< T > | pow (T x, const RWGenMat< T > &y) |
template<class T > | |
RWGenMat< T > | product (const RWGenMat< T > &A, const RWGenMat< T > &B) |
template<class T > | |
RWMathVec< T > | product (const RWGenMat< T > &A, const RWMathVec< T > &v) |
template<class T > | |
RWGenMat< T > | sin (const RWGenMat< T > &x) |
template<class T > | |
RWGenMat< T > | sinh (const RWGenMat< T > &x) |
template<class T > | |
RWGenMat< T > | sqrt (const RWGenMat< T > &x) |
template<class T > | |
RWGenMat< T > | tan (const RWGenMat< T > &x) |
template<class T > | |
RWGenMat< T > | tanh (const RWGenMat< T > &x) |
RWGenMat< signed char > | toChar (const RWGenMat< int > &V) |
RWGenMat< float > | toFloat (const RWGenMat< double > &V) |
RWGenMat< int > | toInt (const RWGenMat< double > &V) |
RWGenMat< int > | toInt (const RWGenMat< float > &V) |
template<class T > | |
RWGenMat< T > | transpose (const RWGenMat< T > &x) |
template<class T > | |
RWGenMat< T > | transposeProduct (const RWGenMat< T > &A, const RWGenMat< T > &B) |
double | variance (const RWGenMat< DComplex > &x) |
double | variance (const RWGenMat< double > &x) |
float | variance (const RWGenMat< float > &x) |
Class RWGenMat is a templatized general matrix class.
typedef RWGenMatConstIterator<T> RWGenMat< T >::const_iterator |
A type that provides a const
random-access iterator over the elements in the container.
typedef std::reverse_iterator<const_iterator> RWGenMat< T >::const_reverse_iterator |
A type that provides a const
random-access, reverse-order iterator over the elements in the container.
typedef RWGenMatIterator<T> RWGenMat< T >::iterator |
A type that provides a random-access iterator over the elements in the container.
typedef rw_numeric_traits<T>::mathFunType RWGenMat< T >::mathFunType |
Typedef for the function pointer used in the method apply(). For more information, see rw_numeric_traits<T>::mathFunType.
typedef rw_numeric_traits<T>::mathFunType2 RWGenMat< T >::mathFunType2 |
Typedef for the function pointer used in the method apply2(). For more information, see rw_numeric_traits<T>::mathFunType2.
typedef rw_numeric_traits<T>::norm_type RWGenMat< T >::norm_type |
Typedef for the usual return type of numerical norm
-like functions. For more information, see rw_numeric_traits<T>::norm_type.
typedef rw_numeric_traits<T>::promote_type RWGenMat< T >::promote_type |
Typedef for the promotion type. For more information, see rw_numeric_traits<T>::promote_type.
A type that provides a random-access, reverse-order iterator over the elements in the container.
|
inline |
|
inline |
Constructs a matrix with a specified number of rows and columns. The optional storage indicator determines whether the matrix is stored in ROW_MAJOR
or COLUMN_MAJOR
order. The RWUninitialized type is an enumeration type with only one value, rwUninitialized. The rwUninitialized argument is used to distinguish the last dimension size from an initial value.
RWGenMat< T >::RWGenMat | ( | size_t | m, |
size_t | n, | ||
RWTRand< RWRandGenerator > & | r, | ||
Storage | = COLUMN_MAJOR ) |
Constructs a matrix with m rows and n columns. Initialized with random numbers generated by r. The optional storage indicator determines whether the matrix is stored in ROW_MAJOR
or COLUMN_MAJOR
order.
|
inline |
Constructs a matrix with a specified number of rows and columns. Initializes each matrix element to initval. The optional storage indicator determines whether the matrix is stored in ROW_MAJOR
or COLUMN_MAJOR
order.
RWGenMat< T >::RWGenMat | ( | const char * | s, |
Storage | = COLUMN_MAJOR ) |
Constructs a matrix from the null terminated character string s. The format of the character string is the same as that expected by the global operator operator>> described in this entry. The optional storage indicator determines whether the matrix is stored in ROW_MAJOR
or COLUMN_MAJOR
order.
|
inline |
Copy constructor. The new matrix and the old matrix both view the same data.
RWGenMat< T >::RWGenMat | ( | const T * | dat, |
size_t | m, | ||
size_t | n, | ||
Storage | = COLUMN_MAJOR ) |
A matrix with m rows and n columns is constructed, using the data in the vector dat as initial data. A copy of dat is made. The vector dat must have at least n * m elements. The optional storage indicator determines whether the matrix is stored in ROW_MAJOR
or COLUMN_MAJOR
order.
RWGenMat< T >::RWGenMat | ( | const RWMathVec< T > & | vec, |
size_t | m, | ||
size_t | s, | ||
Storage | = COLUMN_MAJOR ) |
A matrix with m rows and n columns is constructed, using the data in the vector v. The matrix is a new view of the same data as v, so no copy of the data is made. The optional storage indicator determines whether the matrix is stored in ROW_MAJOR
or COLUMN_MAJOR
order. If the vector does not have length m times n, an exception of type MATX_NUMBERPOINTS
is thrown.
RWGenMat< T >::RWGenMat | ( | const RWGenMat< double > & | re, |
const RWGenMat< double > & | im, | ||
Storage | = COLUMN_MAJOR ) |
A complex matrix is constructed from the double precision matrices re and im, with the real part of the matrix equal to re and the imaginary part equal to im. A new copy of the data is made. The optional storage indicator determines whether the matrix is stored in ROW_MAJOR
or COLUMN_MAJOR
order.
RWGenMat< T > RWGenMat< T >::apply | ( | mathFunType | f | ) | const |
Returns the result of applying the passed function to every element in the matrix. A function of type RWGenMat<T>::mathFunType takes and returns a T
. A function of type RWGenMat<T>::mathFunType2 takes a T
and returns an RWGenMat<T>::norm_type. For a description of this type, see rw_numeric_traits.
RWGenMat< norm_type > RWGenMat< T >::apply2 | ( | mathFunType2 | f | ) | const |
Returns the result of applying the passed function to every element in the matrix. A function of type RWGenMat<T>::mathFunType takes and returns a T
. A function of type RWGenMat<T>::mathFunType2 takes a T
and returns an RWGenMat<T>::norm_type. For a description of this type, see rw_numeric_traits.
|
inline |
Returns an iterator that points to the element in the first row and first column of self. The optional storage specifier determines the order in which the iterator traverses the elements of the matrix; the specifier is independent of the storage format of the matrix. A COLUMN_MAJOR
iterator proceeds down each column while a ROW_MAJOR
iterator proceeds along rows.
ROW_MAJOR
iterator and a COLUMN_MAJOR
iterator have unpredictable results.
|
inline |
Returns an iterator that points to the element in the first row and first column of self. The optional storage specifier determines the order in which the iterator traverses the elements of the matrix; the specifier is independent of the storage format of the matrix. A COLUMN_MAJOR
iterator proceeds down each column while a ROW_MAJOR
iterator proceeds along rows.
ROW_MAJOR
iterator and a COLUMN_MAJOR
iterator have unpredictable results. size_t RWGenMat< T >::binaryStoreSize | ( | ) | const |
Returns the number of bytes required to store the matrix to an RWFile using member function saveOn(RWFile&).
|
inline |
Returns an iterator that points to the element in the first row and first column of self. The optional storage specifier determines the order in which the iterator traverses the elements of the matrix; the specifier is independent of the storage format of the matrix. A COLUMN_MAJOR
iterator proceeds down each column while a ROW_MAJOR
iterator proceeds along rows.
ROW_MAJOR
iterator and a COLUMN_MAJOR
iterator have unpredictable results.
|
inline |
Returns an iterator that points to one element past the last element in the matrix. The optional storage specifier determines the order in which the iterator traverses the elements of the matrix; the specifier is independent of the storage format of the matrix. A COLUMN_MAJOR
iterator proceeds down each column, while a ROW_MAJOR
iterator proceeds along rows.
ROW_MAJOR
iterator and a COLUMN_MAJOR
iterator have unpredictable results. Returns a vector that views a column of the matrix.
Returns a vector that views a column of the matrix.
|
inline |
Returns the number of columns of the matrix.
|
inline |
Returns the stride to move through the data from one column to the next. Could be computed as &A(i,j+1)-&A(i,j)
.
RWGenMat< T > RWGenMat< T >::copy | ( | Storage | s = COLUMN_MAJOR | ) | const |
Returns a copy with distinct instance variables. The optional storage indicator determines whether the matrix is stored in ROW_MAJOR
or COLUMN_MAJOR
order.
|
inline |
Returns an iterator that points to the element in the first row and first column of self. The optional storage specifier determines the order in which the iterator traverses the elements of the matrix; the specifier is independent of the storage format of the matrix. A COLUMN_MAJOR
iterator proceeds down each column while a ROW_MAJOR
iterator proceeds along rows.
ROW_MAJOR
iterator and a COLUMN_MAJOR
iterator have unpredictable results.
|
inline |
Returns an iterator that points to one element before the first element in the matrix. The optional storage specifier determines the order in which the iterator traverses the elements of the matrix; the specifier is independent of the storage format of the matrix. A COLUMN_MAJOR
iterator proceeds down each column, while a ROW_MAJOR
iterator proceeds along rows.
ROW_MAJOR
iterator and a COLUMN_MAJOR
iterator have unpredictable results.
|
inline |
Returns a pointer to the start of a matrix's data. Should be used with care, as this function accesses the matrix's data directly.
|
inline |
Returns a pointer to the start of a matrix's data. Should be used with care, as this function accesses the matrix's data directly.
RWGenMat< T > RWGenMat< T >::deepCopy | ( | Storage | s = COLUMN_MAJOR | ) | const |
Alias for copy().
void RWGenMat< T >::deepenShallowCopy | ( | Storage | s = COLUMN_MAJOR | ) |
Invoking deepenShallowCopy() for a matrix guarantees that there is only one reference to that object and that its data are in contiguous storage. The optional storage indicator determines whether the matrix is stored in ROW_MAJOR
or COLUMN_MAJOR
order.
Returns the diagonal elements of the matrix as a vector, with optional bounds checking. The default idiag = 0
implies the main diagonal; idiag = n
implies n
diagonal slices up from center; idiag = -n
implies n
diagonal slices down.
Returns the diagonal elements of the matrix as a vector, with optional bounds checking. The default idiag = 0
implies the main diagonal; idiag = n
implies n
diagonal slices up from center; idiag = -n
implies n
diagonal slices down.
|
inline |
Returns an iterator that points to one element past the last element in the matrix. The optional storage specifier determines the order in which the iterator traverses the elements of the matrix; the specifier is independent of the storage format of the matrix. A COLUMN_MAJOR
iterator proceeds down each column, while a ROW_MAJOR
iterator proceeds along rows.
ROW_MAJOR
iterator and a COLUMN_MAJOR
iterator have unpredictable results.
|
inline |
Returns an iterator that points to one element past the last element in the matrix. The optional storage specifier determines the order in which the iterator traverses the elements of the matrix; the specifier is independent of the storage format of the matrix. A COLUMN_MAJOR
iterator proceeds down each column, while a ROW_MAJOR
iterator proceeds along rows.
ROW_MAJOR
iterator and a COLUMN_MAJOR
iterator have unpredictable results.
|
inline |
Implicit conversion operator to rw_numeric_traits::promote_type.
Returns true
if self and the argument are equivalent (or not equivalent). That is, they must have the same number of rows as well as columns, and each element in self must equal the corresponding element in the argument.
|
inline |
Subscripting operator for the matrix, with optional bounds checking. Bounds checking is enabled by defining the preprocessor macro RWBOUNDS_CHECK
before including the header file. All subscripting operators return a new view of the same data as the matrix being subscripted. An object of type RWRange or RWToEnd, the global object RWAll, or a character string may be substituted for an RWSlice.
|
inline |
Subscripting operator for the matrix, with optional bounds checking. Bounds checking is enabled by defining the preprocessor macro RWBOUNDS_CHECK
before including the header file. All subscripting operators return a new view of the same data as the matrix being subscripted. An object of type RWRange or RWToEnd, the global object RWAll, or a character string may be substituted for an RWSlice.
Subscripting operator for the matrix, with optional bounds checking. Bounds checking is enabled by defining the preprocessor macro RWBOUNDS_CHECK
before including the header file. All subscripting operators return a new view of the same data as the matrix being subscripted. An object of type RWRange or RWToEnd, the global object RWAll, or a character string may be substituted for an RWSlice.
|
inline |
Subscripting operator for the matrix, with optional bounds checking. Bounds checking is enabled by defining the preprocessor macro RWBOUNDS_CHECK
before including the header file. All subscripting operators return a new view of the same data as the matrix being subscripted. An object of type RWRange or RWToEnd, the global object RWAll, or a character string may be substituted for an RWSlice.
Subscripting operator for the matrix, with optional bounds checking. Bounds checking is enabled by defining the preprocessor macro RWBOUNDS_CHECK
before including the header file. All subscripting operators return a new view of the same data as the matrix being subscripted. An object of type RWRange or RWToEnd, the global object RWAll, or a character string may be substituted for an RWSlice.
|
inline |
Subscripting operator for the matrix, with optional bounds checking. Bounds checking is enabled by defining the preprocessor macro RWBOUNDS_CHECK
before including the header file. All subscripting operators return a new view of the same data as the matrix being subscripted. An object of type RWRange or RWToEnd, the global object RWAll, or a character string may be substituted for an RWSlice.
|
inline |
Subscripting operator for the matrix, with optional bounds checking. Bounds checking is enabled by defining the preprocessor macro RWBOUNDS_CHECK
before including the header file. All subscripting operators return a new view of the same data as the matrix being subscripted. An object of type RWRange or RWToEnd, the global object RWAll, or a character string may be substituted for an RWSlice.
|
inline |
Subscripting operator for the matrix, with optional bounds checking. Bounds checking is enabled by defining the preprocessor macro RWBOUNDS_CHECK
before including the header file. All subscripting operators return a new view of the same data as the matrix being subscripted. An object of type RWRange or RWToEnd, the global object RWAll, or a character string may be substituted for an RWSlice.
Assignment by multiplication operator with conventional meaning. The expression u *= v
implies \(u_{ij} = u_{ij} * v_{ij}\). The RWGenMat objects must conform, that is, have the same dimensions.
Assignment by multiplication operator with conventional meaning. The expression u *= s
implies \(u_{ij} = u_{ij} * s\).
|
inline |
Increments each element of self. This overload is invoked if the operator is used as a postfix operator.
Assignment by addition operator with conventional meaning. The expression u += v
implies \(u_{ij} = u_{ij} + v_{ij}\). The RWGenMat objects must conform, that is, have the same dimensions.
Assignment by addition operator with conventional meaning. The expression u += s
implies \(u_{ij} = u_{ij}+ s\).
|
inline |
Decrements each element of self. This overload is invoked if the operator is used as a postfix operator.
Assignment by subtraction operator with conventional meaning. The expression u -= v
implies \(u_{ij} = u_{ij} - v_{ij}\). The RWGenMat objects must conform, that is, have the same dimensions.
Assignment by subtraction operator with conventional meaning. The expression u -= s
implies \(u_{ij} = u_{ij} - s\).
Assignment by division operator with conventional meaning. The expression u /= v
implies \(u_{ij} = u_{ij} / v_{ij}\). The RWGenMat objects must conform, that is, have the same dimensions.
Assignment by division operator with conventional meaning. The expression u /= s
implies \(u_{ij} = u_{ij} / s\).
Assignment operator with conventional meaning. The expression u = v
implies \(u_{ij} = v_{ij}\). The RWGenMat objects must conform, that is, have the same dimensions.
Assignment operator with conventional meaning. The expression u = v
implies \(u_{ij} = v_{ij}\). The RWGenMat objects must conform, that is, have the same dimensions.
Assignment operator with conventional meaning. The expression u = s
implies \(u_{ij} = s\).
Returns true
if self and the argument are equivalent (or not equivalent). That is, they must have the same number of rows as well as columns, and each element in self must equal the corresponding element in the argument.
RWGenMatPick< T > RWGenMat< T >::pick | ( | const RWIntVec & | v1, |
const RWIntVec & | v2 ) |
Returns a matrix pick. The results can be used as an lvalue. You can think of the "picked" submatrix as specifying an intersection of the rows listed in v1 and the columns listed in v2. Before using this function, you must include the header file rw\math\matpick.h
.
const RWGenMatPick< T > RWGenMat< T >::pick | ( | const RWIntVec & | v1, |
const RWIntVec & | v2 ) const |
Returns a matrix pick. The results can be used as an lvalue. You can think of the "picked" submatrix as specifying an intersection of the rows listed in v1 and the columns listed in v2. Before using this function, you must include the header file rw\math\matpick.h
.
|
inline |
Returns an iterator that points to the element in the last row and last column of self. The optional storage specifier determines the order in which the iterator traverses the elements of the matrix; the specifier is independent of the storage format of the matrix. A COLUMN_MAJOR
iterator proceeds down each column while a ROW_MAJOR
iterator proceeds along rows.
ROW_MAJOR
iterator and a COLUMN_MAJOR
iterator have unpredictable results.
|
inline |
Returns an iterator that points to the element in the first row and first column of self. The optional storage specifier determines the order in which the iterator traverses the elements of the matrix; the specifier is independent of the storage format of the matrix. A COLUMN_MAJOR
iterator proceeds down each column while a ROW_MAJOR
iterator proceeds along rows.
ROW_MAJOR
iterator and a COLUMN_MAJOR
iterator have unpredictable results. Makes self a view of the data contained in m. The view currently associated with the matrix is lost.
|
inline |
Returns an iterator that points to one element before the first element in the matrix. The optional storage specifier determines the order in which the iterator traverses the elements of the matrix; the specifier is independent of the storage format of the matrix. A COLUMN_MAJOR
iterator proceeds down each column, while a ROW_MAJOR
iterator proceeds along rows.
ROW_MAJOR
iterator and a COLUMN_MAJOR
iterator have unpredictable results.
|
inline |
Returns an iterator that points to one element past the last element in the matrix. The optional storage specifier determines the order in which the iterator traverses the elements of the matrix; the specifier is independent of the storage format of the matrix. A COLUMN_MAJOR
iterator proceeds down each column, while a ROW_MAJOR
iterator proceeds along rows.
ROW_MAJOR
iterator and a COLUMN_MAJOR
iterator have unpredictable results. void RWGenMat< T >::reshape | ( | size_t | m, |
size_t | n, | ||
Storage | s = COLUMN_MAJOR ) |
Changes the size of the matrix to m rows and n columns. After reshaping, the contents of the matrix are undefined; that is, they can be garbage, and probably will be. The optional storage indicator determines whether the matrix is stored in ROW_MAJOR
or COLUMN_MAJOR
order.
void RWGenMat< T >::resize | ( | size_t | m, |
size_t | n, | ||
Storage | s = COLUMN_MAJOR ) |
Changes the size of the matrix to m rows and n columns, adding 0s or truncating as necessary. The optional storage indicator determines whether the matrix is stored in ROW_MAJOR
or COLUMN_MAJOR
order.
void RWGenMat< T >::restoreFrom | ( | RWFile & | , |
Storage | s = COLUMN_MAJOR ) |
Restores self from an RWFile. The optional storage indicator determines whether the matrix is stored in ROW_MAJOR
or COLUMN_MAJOR
order. To use these functions with a user-defined type T, the corresponding operator >>
must be defined:
void RWGenMat< T >::restoreFrom | ( | RWvistream & | , |
Storage | s = COLUMN_MAJOR ) |
Restores self from a virtual stream. The optional storage indicator determines whether the matrix is stored in ROW_MAJOR
or COLUMN_MAJOR
order. To use these functions with a user-defined type T, the corresponding operator >>
must be defined:
Returns a vector that views a row of the matrix.
Returns a vector that views a row of the matrix.
|
inline |
Return the number of rows of the matrix.
|
inline |
Returns the stride required to move through the data from one row to the next. Could be computed as &A(i+1,j)-&A(i,j)
.
Stores self in a binary format to an RWFile. If T is a user-defined type, the shift operator<<
must be defined:
void RWGenMat< T >::saveOn | ( | RWvostream & | ) | const |
Stores self to a virtual stream. If T is a user-defined type, the shift operator<<
must be defined:
|
inline |
Returns a matrix that views a slice of the matrix. The slice begins at element i, j and contains m rows and n columns. The increment between successive elements in the slice's row is rowstr1 rows and colstr1 columns. The increment between successive elements in the slice's column is rowstr2 rows and colstr2 columns. For example:
returns a view of the n x n matrix A
upside down. A more readable way to accomplish this is:
|
inline |
Returns a vector that views a slice of the matrix. The slice begins at element i,j and extends for n elements. The increment between successive elements in the vector is rowstride rows and colstride columns. For example:
is a view of the diagonal from the bottom left to top right corners of the n x n matrix A
.
Returns the absolute values of each element.
Program Output:
See the example in abs(const RWGenMat<double>&)
Returns the absolute values of each element.
Program Output:
Returns the absolute values of each element.
Program Output:
See the example in abs(const RWGenMat<double>&)
double
. Therefore, if abs() is invoked for class RWGenMat, a vector of class RWGenMat is returned. See the example in abs(const RWGenMat<double>&)
Returns the absolute values of each element.
Program Output:
See the example in abs(const RWGenMat<double>&)
double
. Therefore, if abs() is invoked for class RWGenMat, a vector of class RWGenMat is returned. See the example in abs(const RWGenMat<double>&)
Returns the absolute values of each element.
Program Output:
See the example in abs(const RWGenMat<double>&)
double
. Therefore, if abs() is invoked for class RWGenMat, a vector of class RWGenMat is returned. See the example in abs(const RWGenMat<double>&)
Returns arc cosines y
such that \(y_{i} = cos^{-1} (x_{i})\). The yi
(in radians) are in the range \(0 < y_{i} \leq \pi\), for elements xi with absolute values \(|x_{i}| \leq 1\).
Takes x as an argument and returns arc sines y
such that \(y_{i} = sin^{-1}(x_{i})\). The yi
(in radians) are in the range \(-\pi/2 < y_{i} \leq \pi/2\), for elements xi with absolute values \(|x_{i}| \leq 1\).
Takes x and returns y
of arc tangents (in radians), such that \(y_{i} = tan^{-1}x_{i}\), where \(-\pi/2 < y_{i} \leq \pi/2\).
Takes two arguments and returns quadrant correct arc tangents z
(in radians), such that \(z_{i} = tan^{-1} ( x_{i}/y_{i})\). For each element i
, the expression \(atan2(x_{i}, y_{i})\) is mathematically equivalent to:
\[ tan^{-1}\left(\frac{x_i}{y_i}\right) \]
At least one of the arguments xi or yi must be nonzero.
Takes x as an argument and returns y
such that yi
corresponds to the next integer greater than or equal to xi. For example, if x = [ -1.3, 4.3, 7.9]
then y = [ -1, 5, 8].
Takes complex x as an argument and returns the complex conjugates \(x^{*}\). For example, if \(x_{i} = (2.3, 1.4)\), then \(x_{i}^{*} = (2.3, -1.4)\).
|
related |
Takes a matrix A (of M
rows by N
columns) and a matrix B (of M
rows by P
columns) as arguments and returns a matrix C
(of N
rows by P
columns) which is equal to conj(A)TB
, that is, the inner product of the conjugate transpose of A with B.
If the number of rows in A does not match the number of rows in B, an exception with value RWLAPK_MATMATPROD
occurs.
C = product(conj(transpose(A)), B)
. Takes x as an argument and returns y
such that \(y_{i} = cos(x_{i})\). The xi are in radians. For complex arguments, the complex cosine is returned.
Takes x as an argument and returns hyperbolic cosines y
such that \(y_{i} = cosh(x_{i})\). For complex arguments, the complex hyperbolic cosine is returned.
|
related |
Returns the determinant of the matrix from which an LU factorization A is constructed.
|
related |
Takes two matrices, A and B, and returns a matrix C
such that:
\[ C_{ij} = A_{ij}B_{ij} \]
Takes an argument x and returns y
such that:
\[ y_i = e^{x_i} \]
If class T
is complex, the complex exponential is returned.
Takes x as an argument and returns y
such that yi
corresponds to the largest integer less than or equal to xi. For example, if x = [ 1.3, 4.4, -3.2]
, then y = [ 1, 4, -4].
Computes the Frobenius norm, which is the square root of the sum of squares of its entries. For a matrix, the formula is:
\[ \left \| A \right \|_{\text{Frob}} = \sqrt{\sum_{i=0}^{M-1} \sum_{j=0}^{N-1} \left | \text{a}_{ij} \right |^2} \]
|
related |
Computes the Frobenius norm, which is the square root of the sum of squares of its entries. For a matrix, the formula is:
\[ \left \| A \right \|_{\text{Frob}} = \sqrt{\sum_{i=0}^{M-1} \sum_{j=0}^{N-1} \left | \text{a}_{ij} \right |^2} \]
|
related |
Computes the Frobenius norm, which is the square root of the sum of squares of its entries. For a matrix, the formula is:
\[ \left \| A \right \|_{\text{Frob}} = \sqrt{\sum_{i=0}^{M-1} \sum_{j=0}^{N-1} \left | \text{a}_{ij} \right |^2} \]
Takes complex x as an argument and returns y
containing the imaginary parts \(y_{i} = Im(x_{i})\). With most versions of complex, the results can be used as an l-value:
The function l1Norm()is the maximum of the l1Norms
of its columns:
\[ \left \| A \right \|_1 = \begin{array}{c c} \scriptstyle max \\ \scriptstyle j=0,...,N-1 \end{array} \sum_{i=0}^{N-1}\left | a_i \right | \]
|
related |
The function l1Norm()is the maximum of the l1Norms
of its columns:
\[ \left \| A \right \|_1 = \begin{array}{c c} \scriptstyle max \\ \scriptstyle j=0,...,N-1 \end{array} \sum_{i=0}^{N-1}\left | a_i \right | \]
|
related |
The function l1Norm()is the maximum of the l1Norms
of its columns:
\[ \left \| A \right \|_1 = \begin{array}{c c} \scriptstyle max \\ \scriptstyle j=0,...,N-1 \end{array} \sum_{i=0}^{N-1}\left | a_i \right | \]
The function l1Norm()is the maximum of the l1fNorms
of its rows:
\[ \left \| xA \right \|_{\infty} = \begin{array}{c c} \scriptstyle max \\ \scriptstyle i=0,...,N-1 \end{array} \sum_{j=0}^{N-1}\left | a_{ij} \right | \]
|
related |
The function l1Norm()is the maximum of the l1fNorms
of its rows:
\[ \left \| xA \right \|_{\infty} = \begin{array}{c c} \scriptstyle max \\ \scriptstyle i=0,...,N-1 \end{array} \sum_{j=0}^{N-1}\left | a_{ij} \right | \]
|
related |
The function l1Norm()is the maximum of the l1fNorms
of its rows:
\[ \left \| xA \right \|_{\infty} = \begin{array}{c c} \scriptstyle max \\ \scriptstyle i=0,...,N-1 \end{array} \sum_{j=0}^{N-1}\left | a_{ij} \right | \]
Takes x as an argument and returns natural logarithms y
such that \(y_{i}=log(x_{i})\). The arguments xi must not be 0. For complex arguments, the principal value of the complex natural logarithm is returned.
Takes x as an argument and returns base 10 logarithms y
such that \(y_{i}=log_{10}(x_{i})\). The arguments xi must not be 0.
|
related |
Return the index
of the maximum element of the vector. If instead you want the maximum value
use function maxValue().
Returns the value of the element with largest absolute value. Note that this is not a norm in the mathematical sense of the word.
|
related |
Returns the value of the element with largest absolute value. Note that this is not a norm in the mathematical sense of the word.
|
related |
Returns the value of the element with largest absolute value. Note that this is not a norm in the mathematical sense of the word.
|
related |
Return the maximum value.
|
related |
Takes an RWGenMat as an argument and returns <x>, the mean value, where:
\[ \langle x \rangle = \frac{1}{n}\sum_{i=0}^{n-1}x_i \]
For example, if x = [1, 4, 3, 4]
, then <x> = 3
.
|
related |
Return the index
of the minimum element of the vector. If instead you want the minimum value
use function minValue().
|
related |
Return the minimum value.
Takes complex x as an argument and returns real y
containing the norm:
\[ y_{i} = [Re(x_{i})]^{2} + [Im(x_{i})]^{2} \]
|
related |
Conventional mathematical linear algebra multiplication operator; that is, the i,j
element of the result of a matrix product AB is the dot product of the ith
row of A and the jth
column of B.
|
related |
Conventional mathematical linear algebra multiplication operator; that is, the i,j
element of the result of a matrix product AB is the dot product of the ith
row of A and the jth
column of B.
|
related |
Conventional mathematical linear algebra multiplication operator; that is, the i,j
element of the result of a matrix product AB is the dot product of the ith
row of A and the jth
column of B.
|
related |
Multiplication operator, which is applied element-by-element. For instance, for matrices u, v, and w
, the expression w = u * v
implies \(w_{ij} = u_{ij} * v_{ij}\). The two RWGenMat objects must conform, that is, have the same numbers of rows and columns, or an exception with value RWMATH_MNMATCH
occurs.
Multiplication operator, which is applied element-by-element. For instance, for matrices u, w
, and scalar s, the expression w = u * s
implies \(w_{ij} = u_{ij} * s\).
Multiplication operator, which is applied element-by-element. For instance, for matrices v, w
, and scalar s, the expression w = s * v
implies \(w_{ij} = s * v_{ij}\).
|
related |
Addition operator, which is applied element-by-element. For instance, for matrices u, v, and w
, the expression w = u + v
implies \(w_{ij} = u_{ij} + v_{ij}\). The two RWGenMat objects must conform, that is, have the same numbers of rows and columns, or an exception with value RWMATH_MNMATCH
occurs.
Addition operator, which is applied element-by-element. For instance, for matrices u, w
, and scalar s, the expression w = u + s
implies \(w_{ij} = u_{ij} + s\).
Unary plus operator, which is applied element-by-element. For instance, for matrices v, and w
, the expression w = +v
implies \(w_{ij} = + v_{ij}\).
Addition operator, which is applied element-by-element. For instance, for matrices v, w
, and scalar s, the expression w = s + v
implies \(w_{ij} = s + v_{ij}\).
|
related |
Subtraction operator, which is applied element-by-element. For instance, for matrices u, v, and w
, the expression w = u - v
implies \(w_{ij} = u_{ij} - v_{ij}\). The two RWGenMat objects must conform, that is, have the same numbers of rows and columns, or an exception with value RWMATH_MNMATCH
occurs.
Subtraction operator, which is applied element-by-element. For instance, for matrices u, w
, and scalar s, the expression w = u - s
implies \(w_{ij} = u_{ij} - s\).
Unary minus operator, which is applied element-by-element. For instance, for matrices v, and w
, the expression w = -v
implies \(w_{ij} = - v_{ij}\).
Subtraction operator, which is applied element-by-element. For instance, for matrices v, w
, and scalar s, the expression w = s - v
implies \(w_{ij} = s - v_{ij}\).
|
related |
Division operator, which is applied element-by-element. For instance, for matrices u, v, and w
, the expression w = u / v
implies \(w_{ij} = u_{ij} / v_{ij}\). The two RWGenMat objects must conform, that is, have the same numbers of rows and columns, or an exception with value RWMATH_MNMATCH
occurs.
Division operator, which is applied element-by-element. For instance, for matrices u, w
, and scalar s, the expression w = u / s
implies \(w_{ij} = u_{ij} / s\).
Division operator, which is applied element-by-element. For instance, for matrices v, w
, and scalar s, the expression w = s / v
implies \(w_{ij} = s / v_{ij}\).
|
related |
Outputs a matrix m to std::ostream s. First, the number of rows and columns is output, then the values, separated by spaces, are output row by row, beginning with a left bracket [ and terminating with a right bracket
].
|
related |
Reads a matrix v from istream s. First, the number of rows and columns is read, then the matrix values, separated by white space, row-by-row. If the sequence of numbers begins with a left bracket [ , the operator reads to a matching right bracket
]. If no bracket is present, it reads to end of file. The matrix v is stored in
COLUMN_MAJOR
order.
The function pow() takes two arguments: pow( x, y ).
Returns z
such that:
\[ z_i = (x_i)^{y_i} \]
If the number of elements in x does not match the number of elements in y, an exception with value RWMATH_MNMATCH
will occur.
|
related |
Returns the inner product of its two arguments. Takes two matrices A and B returns:
\[ C_{ij} = \sum_{k=0}^{P-1} A_{ik}B_{kj} \]
The function checks to make sure that the number of columns in A equals the number of rows in B. Otherwise, an exception with value MATX_MATMATPROD
occurs.
|
related |
Returns the inner product of its two arguments. Takes a matrix A and a vector v as arguments returns:
\[ y_i = \sum_{j=0}^{n-1} A_{ij}v_j \]
The function checks to make sure that the number of columns in A equals the number of elements in v. Otherwise, an exception with value MATX_MATVECPROD
occurs.
Takes a complex argument x and returns real y
containing the real part \(y_{i}=Re(x_{i})\). With most versions of complex, the results can be used as an l-value:
The function sin() takes x as an argument and returns y
such that \(y_{i} = sin(x_{i})\). The xi are in radians. For complex classes, the complex sine is returned.
The function sinh() takes x as an argument and returns y
such that \(y_{i} = sinh(x_{i})\). For complex classes, the complex hyperbolic sine is returned.
The square root function. Takes x as an argument and returns y
such that \(y_{i} = (x_{i})^{1/2}\). For complex classes, the principal value of the complex square root is returned.
The function tan() takes argument x and returns y
such that \(y_{i} = tan(x_{i})\).
The function tanh() takes argument x and returns y
such that \(y_{i} = tanh(x_{i})\).
Converts an RWGenMat instance into a corresponding RWGenMat instance. Note that this is a narrowing operation; high order bits are removed.
Converts an RWGenMat instance into a corresponding RWGenMat instance. Note that this is a narrowing operation; high order bits are removed.
Converts an RWGenMat instance into a corresponding RWGenMat instance. Note that truncation occurs.
Converts an RWGenMat instance into a corresponding RWGenMat instance. Note that truncation occurs.
Takes a matrix x as an argument and returns the transpose \(y_{ik} = x_{ki}\). The matrix returned is a new view of the same data as the argument matrix. Use RWGenMat::copy() or RWGenMat::deepenShallowCopy() to make the views distinct.
|
related |
Takes a matrix A (of M
rows by N
columns) and a matrix B (of M
rows by P
columns) as arguments, and returns a matrix C
(of N
rows by P
columns) that is equal to ATB, that is, the inner product of the transpose of A with B:
\[ C_{np} = \sum_{m=0}^M A_{mn}B_{mp} \]
If the number of rows in A does not match the number of rows in B, an exception with value RWLAPK_MATMATPROD
occurs.
Note that calling this function is equivalent to calling:
Takes a matrix x as an argument and returns its variance y
as in:
\[ y=\frac{1}{N}\sum_{i=0}^{N-1}(x_i-<x>)^2 \]
where <x> is the mean of the matrix and N
is the number of rows times columns. Note that this is the biased variance.
|
related |
Takes a matrix x as an argument and returns its variance y
as in:
\[ y=\frac{1}{N}\sum_{i=0}^{N-1}(x_i-<x>)^2 \]
where <x> is the mean of the matrix and N
is the number of rows times columns. Note that this is the biased variance.
|
related |
Takes a matrix x as an argument and returns its variance y
as in:
\[ y=\frac{1}{N}\sum_{i=0}^{N-1}(x_i-<x>)^2 \]
where <x> is the mean of the matrix and N
is the number of rows times columns. Note that this is the biased variance.
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |