CVM Class Library
8.1
This C++ class library encapsulates concepts of vector and different matrices including square, band, symmetric and hermitian ones in Euclidean space of real and complex numbers.
|
End-user class encapsulating matrix of real numbers. More...
#include <cvm.h>
Public Member Functions | |
basic_rmatrix () | |
Default constructor. | |
basic_rmatrix (tint nM, tint nN) | |
Constructor. | |
basic_rmatrix (TR *pd, tint nM, tint nN) | |
Constructor. | |
basic_rmatrix (const TR *pd, tint nM, tint nN) | |
Constructor. | |
basic_rmatrix (const basic_rmatrix &m) | |
Copy constructor. | |
basic_rmatrix (basic_rmatrix &&m) noexcept | |
Move constructor. | |
basic_rmatrix (const RVector &v, bool bBeColumn=true) | |
Constructor. | |
basic_rmatrix (basic_rmatrix &m, tint nRow, tint nCol, tint nHeight, tint nWidth) | |
Submatrix constructor. | |
type_proxy< TR, TR > | operator() (tint nRow, tint nCol) throw (cvmexception) |
Reference to element (l-value) | |
TR | operator() (tint nRow, tint nCol) const throw (cvmexception) |
Value of element (not l-value) | |
RVector | operator() (tint nCol) throw (cvmexception) |
Column as l-value. | |
RVector | operator[] (tint nRow) throw (cvmexception) |
Row as l-value. | |
const RVector | operator() (tint nCol) const throw (cvmexception) |
Column as not l-value. | |
const RVector | operator[] (tint nRow) const throw (cvmexception) |
Row as not l-value. | |
RVector | diag (tint nDiag) throw (cvmexception) |
Diagonal as l-value. | |
const RVector | diag (tint nDiag) const throw (cvmexception) |
Diagonal (not l-value) | |
basic_rmatrix & | operator= (const basic_rmatrix &m) throw (cvmexception) |
Assignment operator. | |
basic_rmatrix & | operator= (basic_rmatrix &&m) throw (cvmexception) |
Move assignment operator. | |
basic_rmatrix & | assign (const RVector &v) throw (cvmexception) |
Vector (as array) assignment. | |
basic_rmatrix & | assign (const TR *pd) |
External array assignment. | |
basic_rmatrix & | assign (tint nRow, tint nCol, const basic_rmatrix &m) throw (cvmexception) |
Assignment to submatrix. | |
basic_rmatrix & | set (TR d) |
Sets all elements to one value. | |
basic_rmatrix & | resize (tint nNewM, tint nNewN) throw (cvmexception) |
Changes dimensions. | |
bool | operator== (const basic_rmatrix &m) const |
Matrix comparison. | |
bool | operator!= (const basic_rmatrix &m) const |
Matrix comparison. | |
basic_rmatrix & | operator<< (const basic_rmatrix &m) throw (cvmexception) |
Matrix replacement. | |
basic_rmatrix | operator+ (const basic_rmatrix &m) const throw (cvmexception) |
Addition operator. | |
basic_rmatrix | operator- (const basic_rmatrix &m) const throw (cvmexception) |
Subtraction operator. | |
basic_rmatrix & | sum (const basic_rmatrix &m1, const basic_rmatrix &m2) throw (cvmexception) |
Sum of matrices. | |
basic_rmatrix & | diff (const basic_rmatrix &m1, const basic_rmatrix &m2) throw (cvmexception) |
Difference of matrices. | |
basic_rmatrix & | operator+= (const basic_rmatrix &m) throw (cvmexception) |
Increment operator. | |
basic_rmatrix & | operator-= (const basic_rmatrix &m) throw (cvmexception) |
Decrement operator. | |
basic_rmatrix | operator- () const |
Unary minus operator. | |
basic_rmatrix | operator* (TR dMult) const |
Multiply by number operator. | |
basic_rmatrix | operator/ (TR dDiv) const throw (cvmexception) |
Divide by number operator. | |
basic_rmatrix & | operator*= (TR dMult) |
Multiply by number and assign. | |
basic_rmatrix & | operator/= (TR dDiv) throw (cvmexception) |
Divide by number and assign. | |
basic_rmatrix & | normalize () |
Matrix normalizer. | |
basic_rmatrix | operator~ () const throw (cvmexception) |
Matrix transposition. | |
basic_rmatrix & | transpose (const basic_rmatrix &m) throw (cvmexception) |
Matrix transposition. | |
basic_rmatrix & | transpose () throw (cvmexception) |
Matrix transposition (in-place) | |
RVector | operator* (const RVector &v) const throw (cvmexception) |
Matrix-vector product. | |
basic_rmatrix | operator* (const basic_rmatrix &m) const throw (cvmexception) |
Matrix-matrix product. | |
basic_rmatrix & | mult (const basic_rmatrix &m1, const basic_rmatrix &m2) throw (cvmexception) |
Matrix-matrix product. | |
basic_rmatrix & | rank1update (const RVector &vCol, const RVector &vRow) throw (cvmexception) |
Rank-1 update. | |
basic_rmatrix & | swap_rows (tint n1, tint n2) throw (cvmexception) |
Rows swap. | |
basic_rmatrix & | swap_cols (tint n1, tint n2) throw (cvmexception) |
Columns swap. | |
basic_rmatrix & | solve (const basic_srmatrix< TR > &mA, const basic_rmatrix &mB, TR &dErr) throw (cvmexception) |
Linear solver. | |
basic_rmatrix & | solve_tran (const basic_srmatrix< TR > &mA, const basic_rmatrix &mB, TR &dErr) throw (cvmexception) |
Linear solver (transposed) | |
basic_rmatrix & | solve (const basic_srmatrix< TR > &mA, const basic_rmatrix &mB) throw (cvmexception) |
Linear solver. | |
basic_rmatrix & | solve_tran (const basic_srmatrix< TR > &mA, const basic_rmatrix &mB) throw (cvmexception) |
Linear solver (transposed) | |
basic_rmatrix & | solve_lu (const basic_srmatrix< TR > &mA, const basic_srmatrix< TR > &mLU, const tint *pPivots, const basic_rmatrix &mB, TR &dErr) throw (cvmexception) |
LU factorization based linear solver. | |
basic_rmatrix & | solve_lu (const basic_srmatrix< TR > &mA, const basic_srmatrix< TR > &mLU, const tint *pPivots, const basic_rmatrix &mB) throw (cvmexception) |
LU factorization based linear solver. | |
RVector | svd () const throw (cvmexception) |
Singular value decomposition. | |
RVector | svd (basic_srmatrix< TR > &mU, basic_srmatrix< TR > &mVH) const throw (cvmexception) |
Singular value decomposition. | |
basic_rmatrix | pinv (TR threshold=basic_cvmMachSp< TR >()) const throw (cvmexception) |
Pseudo (generalized) inversion. | |
basic_rmatrix & | pinv (const basic_rmatrix &mA, TR threshold=basic_cvmMachSp< TR >()) throw (cvmexception) |
Pseudo (generalized) inversion. | |
basic_rmatrix | gels (bool transpose, const basic_rmatrix &mB, basic_rvector< TR > &vErr) const throw (cvmexception) |
Overdetermined or underdetermined linear solver. | |
basic_rmatrix & | gels (bool transpose, const basic_rmatrix &mA, const basic_rmatrix &mB, basic_rvector< TR > &vErr) throw (cvmexception) |
Overdetermined or underdetermined linear solver. | |
basic_rvector< TR > | gels (bool transpose, const basic_rvector< TR > &vB, TR &dErr) const throw (cvmexception) |
Overdetermined or underdetermined linear solver. | |
basic_rmatrix | gelsy (const basic_rmatrix &mB, tint &rank, TR tol=basic_cvmMachSp< TR >()) const throw (cvmexception) |
Linear least squares problem. | |
basic_rmatrix & | gelsy (const basic_rmatrix &mA, const basic_rmatrix &mB, tint &rank, TR tol=basic_cvmMachSp< TR >()) throw (cvmexception) |
Linear least squares problem. | |
basic_rvector< TR > | gelsy (const basic_rvector< TR > &vB, tint &rank, TR tol=basic_cvmMachSp< TR >()) const throw (cvmexception) |
Linear least squares problem. | |
basic_rmatrix | gelss (const basic_rmatrix &mB, basic_rvector< TR > &sv, tint &rank, TR tol=basic_cvmMachSp< TR >()) const throw (cvmexception) |
Linear least squares problem. | |
basic_rmatrix & | gelss (const basic_rmatrix &mA, const basic_rmatrix &mB, basic_rvector< TR > &sv, tint &rank, TR tol=basic_cvmMachSp< TR >()) throw (cvmexception) |
Linear least squares problem. | |
basic_rvector< TR > | gelss (const basic_rvector< TR > &vB, basic_rvector< TR > &sv, tint &rank, TR tol=basic_cvmMachSp< TR >()) const throw (cvmexception) |
Linear least squares problem. | |
basic_rmatrix | gelsd (const basic_rmatrix &mB, basic_rvector< TR > &sv, tint &rank, TR tol=basic_cvmMachSp< TR >()) const throw (cvmexception) |
Linear least squares problem. | |
basic_rmatrix & | gelsd (const basic_rmatrix &mA, const basic_rmatrix &mB, basic_rvector< TR > &sv, tint &rank, TR tol=basic_cvmMachSp< TR >()) throw (cvmexception) |
Linear least squares problem. | |
basic_rvector< TR > | gelsd (const basic_rvector< TR > &vB, basic_rvector< TR > &sv, tint &rank, TR tol=basic_cvmMachSp< TR >()) const throw (cvmexception) |
Linear least squares problem. | |
tint | rank (TR tol=basic_cvmMachSp< TR >()) const throw (cvmexception) |
Matrix rank. | |
void | qr (basic_rmatrix< TR > &mQ, basic_srmatrix< TR > &mR) const throw (cvmexception) |
QR factorization ("economy" mode) | |
void | qr (basic_srmatrix< TR > &mQ, basic_rmatrix< TR > &mR) const throw (cvmexception) |
QR factorization ("full" mode) | |
void | lq (basic_srmatrix< TR > &mL, basic_rmatrix< TR > &mQ) const throw (cvmexception) |
LQ factorization ("economy" mode) | |
void | lq (basic_rmatrix< TR > &mL, basic_srmatrix< TR > &mQ) const throw (cvmexception) |
LQ factorization ("full" mode) | |
void | rq (basic_srmatrix< TR > &mR, basic_rmatrix< TR > &mQ) const throw (cvmexception) |
RQ factorization ("economy" mode) | |
void | rq (basic_rmatrix< TR > &mR, basic_srmatrix< TR > &mQ) const throw (cvmexception) |
RQ factorization ("full" mode) | |
void | ql (basic_rmatrix< TR > &mQ, basic_srmatrix< TR > &mL) const throw (cvmexception) |
QL factorization ("economy" mode) | |
void | ql (basic_srmatrix< TR > &mQ, basic_rmatrix< TR > &mL) const throw (cvmexception) |
QL factorization ("full" mode) | |
basic_rmatrix & | ger (TR alpha, const RVector &vCol, const RVector &vRow) throw (cvmexception) |
Rank-1 update matrix-vector operation. | |
basic_rmatrix & | gemm (const basic_rmatrix &m1, bool bTrans1, const basic_rmatrix &m2, bool bTrans2, TR dAlpha, TR dBeta) throw (cvmexception) |
Generic matrix-matrix operation. | |
basic_rmatrix & | symm (bool bLeft, const basic_srsmatrix< TR > &ms, const basic_rmatrix &m, TR dAlpha, TR dBeta) throw (cvmexception) |
Generic symmetric matrix-matrix operation. | |
basic_rmatrix & | vanish () |
Set matrix to zero. | |
basic_rmatrix & | randomize (TR dFrom, TR dTo) |
Randomizer. | |
TR | norm2 () const override |
2-norm | |
Public Member Functions inherited from Matrix< TR, TR > | |
tint | msize () const |
Number of rows. | |
tint | nsize () const |
Number of columns. | |
tint | ld () const |
Leading dimension. | |
tint | rowofmax () const |
Row with maximum element. | |
tint | rowofmin () const |
Row with minimum element. | |
tint | colofmax () const |
Column with maximum element. | |
tint | colofmin () const |
Column with minimum element. | |
TR | norm1 () const override |
1-norm | |
TR | norminf () const override |
Infinity norm. | |
Public Member Functions inherited from basic_array< TR, TR > | |
basic_array () | |
Default constructor. | |
basic_array (tint nSize, bool bZeroMemory=true) | |
Constructor. | |
basic_array (TR *pd, tint nSize, tint nIncr=1) | |
Constructor. | |
basic_array (const TR *pd, tint nSize, tint nIncr=1) | |
Constructor. | |
basic_array (const TR *begin, const TR *end) | |
Constructor. | |
basic_array (const basic_array &a) | |
Copy constructor. | |
basic_array (basic_array &&a) noexcept | |
Move constructor. | |
basic_array & | operator= (const basic_array &a) throw (cvmexception) |
Assignment operator. | |
basic_array & | operator= (basic_array &&a) throw (cvmexception) |
Move assignment operator. | |
virtual | ~basic_array () |
Destructor. | |
tint | size () const |
Size (length) of array. | |
TR * | get () |
Pointer to data. | |
const TR * | get () const |
Const pointer to data. | |
operator TR * () | |
operator const TR * () const | |
void | assign (size_type n, const TR &val) throw (cvmexception) |
(STL) assigns given value to n-th element (0-based) | |
void | assign (const_iterator begin, const_iterator end) throw (cvmexception) |
(STL) assigns begin-end iteartor range to array | |
basic_array & | resize (tint nNewSize) throw (cvmexception) |
Changes size of array. | |
tint | incr () const |
Increment between elements. | |
tint | indofmax () const |
Index of element with maximum module. | |
tint | indofmin () const |
Index of element with minimum module. | |
virtual TR | norm () const |
Euclidean norm. | |
iterator | begin () |
(STL) iterator to begin | |
const_iterator | begin () const |
(STL) const iterator to begin | |
iterator | end () |
(STL) iterator to end | |
const_iterator | end () const |
(STL) const iterator to end | |
reverse_iterator | rbegin () |
(STL) iterator to begin reversed | |
const_reverse_iterator | rbegin () const |
(STL) const iterator to begin reversed | |
reverse_iterator | rend () |
(STL) iterator to end reversed | |
const_reverse_iterator | rend () const |
(STL) const iterator to end reversed | |
size_type | max_size () const |
(STL) maximum possible size of array | |
size_type | capacity () const |
(STL) current capacity of array, equal to size() | |
bool | empty () const |
(STL) is array empty | |
reference | front () |
(STL) reference to first element | |
const_reference | front () const |
(STL) const reference to first element | |
reference | back () |
(STL) reference to last element | |
const_reference | back () const |
(STL) const reference to last element | |
void | clear () |
(STL) clears array, dealocates memory and sets size() to zero | |
void | swap (basic_array &v) throw (cvmexception) |
(STL) swaps array values, throws cvmexception if sizes are different | |
reference | at (size_type n) throw (cvmexception) |
(STL) returns reference to n-th element of array (0-based), throws cvmexception if n is out of boundaries | |
const_reference | at (size_type n) const throw (cvmexception) |
(STL) returns const reference to n-th element of array (0-based), throws cvmexception if n is out of boundaries | |
void | push_back (const TR &x) throw (cvmexception) |
(STL) pushes new value to the end of array | |
void | pop_back () throw (cvmexception) |
(STL) removes last element from array | |
iterator | insert (iterator position, const TR &x) throw (cvmexception) |
(STL) inserts element to given position in array | |
iterator | erase (iterator position) throw (cvmexception) |
(STL) removes element from given position in array |
Friends | |
class | basic_rvector< TR > |
Additional Inherited Members | |
Public Types inherited from basic_array< TR, TR > | |
typedef TR | value_type |
STL-specific value type definition. | |
typedef value_type * | pointer |
STL-specific value pointer definition. | |
typedef value_type * | iterator |
STL-specific iterator definition. | |
typedef const value_type * | const_iterator |
STL-specific const iterator definition. | |
typedef const value_type * | const_pointer |
STL-specific const pointer definition. | |
typedef value_type & | reference |
STL-specific reference definition. | |
typedef const value_type & | const_reference |
STL-specific const reference definition. | |
typedef size_t | size_type |
STL-specific size type definition. | |
typedef ptrdiff_t | difference_type |
STL-specific difference type definition. | |
typedef std::reverse_iterator < const_iterator > | const_reverse_iterator |
STL-specific const reverse iterator definition. | |
typedef std::reverse_iterator < iterator > | reverse_iterator |
STL-specific reverse iterator definition. | |
Protected Member Functions inherited from Matrix< TR, TR > | |
Matrix () | |
Default constructor. | |
Matrix (tint nM, tint nN, tint nLD, bool bZeroMemory) | |
Constructor. | |
Matrix (TR *pd, tint nM, tint nN, tint nLD, tint nSize) | |
Constructor. | |
Matrix (const TR *pd, tint nM, tint nN, tint nLD, tint nSize) | |
Constructor. | |
Matrix (const BaseArray &v, bool bBeColumn) | |
Constructor. | |
Matrix (Matrix &&m) noexcept | |
Move constructor. | |
Matrix & | operator= (Matrix &&m) throw (cvmexception) |
Move assignment operator. | |
Protected Attributes inherited from Matrix< TR, TR > | |
tint | mm |
Number of rows. | |
tint | mn |
Number of columns. | |
tint | mld |
Leading dimension. |
End-user class encapsulating matrix of real numbers.
TR
type stands for treal. Please use predefined rmatrix class in your applications.
|
inline |
|
inline |
Constructor.
Creates rmatrix object where is passed in nM
parameter (number of rows) and is passed in nN
(number of columns). Constructor sets all elements to zero. It throws cvmexception in case of non-positive sizes passed or memory allocation failure. Example:
prints
[in] | nM | Number of rows. |
[in] | nN | Number of columns. |
|
inline |
Constructor.
Creates rmatrix object where is passed in nM
parameter (number of rows) and is passed in nN
(number of columns). It throws cvmexception in case of non-positive sizes passed. Unlike others, this constructor does not allocate memory. It just shares memory with array pointed to by pd
(for matrices nIncr=1
is always satisfied).
[in] | pd | Pointer to array to share memory with. |
[in] | nM | Number of rows. |
[in] | nN | Number of columns. |
|
inline |
Constructor.
Creates rmatrix object where is passed in nM
parameter (number of rows) and is passed in nN
(number of columns). Constructor throws cvmexception in case of non-positive sizes passed. This is const version, it allocates memory and copies every element (deep copy) from external array pointed to by pd
parameter. It copies nM*nN
elements total. Example:
prints
[in] | pd | Const pointer to external array. |
[in] | nM | Number of rows. |
[in] | nN | Number of columns. |
|
inline |
Copy constructor.
Creates rmatrix object as a copy of matrix m
. It throws cvmexception in case of memory allocation failure.
[in] | m | rmatrix to copy from. |
|
inline |
Move constructor.
Implements move semantics introduced in new C++ standard. Moves data ownership from other matrix to newly created object. It's usually executed implicitly in cases like this:
or this
Here temporary result of calling b.operator+(c)
will not be destroyed but rather moved to newly created object a
.
[in] | m | rvalue reference to other matrix. |
|
inlineexplicit |
Constructor.
Creates rmatrix object containing v.size()
rows and 1 column if bBeColumn
is true
or 1 row and v.size()
columns otherwise. After that it copies elements of vector v
to the matrix created. Constructor throws cvmexception in case of memory allocation failure.
[in] | v | rvector to copy elements from. |
[in] | bBeColumn | True to create column matrix. |
|
inline |
Submatrix constructor.
Creates rmatrix object as submatrix of matrix m
. It means that the matrix object created shares memory with some part of m
. This part is defined by its upper left corner (parameters nRow
and nCol
, both are CVM0 based) and its height and width (parameters nHeight
and nWidth
).
|
inline |
Reference to element (l-value)
Operator provides access to a particular element of calling matrix by its row and column index. Indexes passed are CVM0 based. It returns l-value in order to make possible write access to an element. Operator throws cvmexception if nRow
or nCol
is outside of boundaries.
Reimplemented in basic_srbmatrix< TR >, and basic_srmatrix< TR >.
Definition at line 11028 of file cvm.h.
|
inline |
Value of element (not l-value)
Operator returns value of a particular element of calling matrix by its row and column index. Indexes passed are CVM0 based. Operator throws cvmexception if nRow
or nCol
is outside of boundaries.
Reimplemented in basic_srsmatrix< TR >, basic_srbmatrix< TR >, and basic_srmatrix< TR >.
Definition at line 11065 of file cvm.h.
|
inline |
Column as l-value.
Operator provides access to nCol-th
column (CVM0 based) of calling matrix by returning rvector sharing memory with it. Operator throws cvmexception if nCol
is outside of boundaries.
[in] | nCol | Index of column (CVM0 based). |
Reimplemented from basic_array< TR, TR >.
Reimplemented in basic_srmatrix< TR >.
Definition at line 11107 of file cvm.h.
|
inline |
Row as l-value.
Operator provides access to nRow-th
row (CVM0 based) of calling matrix by returning rvector sharing memory with it. Operator throws cvmexception if nRow
is outside of boundaries.
[in] | nRow | Index of row (CVM0 based). |
Reimplemented from basic_array< TR, TR >.
Reimplemented in basic_srmatrix< TR >.
Definition at line 11149 of file cvm.h.
|
inline |
Column as not l-value.
Operator creates rvector object as a copy of nCol-th
column (CVM0 based) of calling matrix. Operator throws cvmexception if nCol
is outside of boundaries.
[in] | nCol | Index of column (CVM0 based). |
Reimplemented from basic_array< TR, TR >.
Reimplemented in basic_srsmatrix< TR >, basic_srbmatrix< TR >, and basic_srmatrix< TR >.
Definition at line 11181 of file cvm.h.
|
inline |
Row as not l-value.
Operator creates rvector object as a copy of nRow-th
row (CVM0 based) of calling matrix. Operator throws cvmexception if nRow
is outside of boundaries.
[in] | nRow | Index of row (CVM0 based). |
Reimplemented from basic_array< TR, TR >.
Reimplemented in basic_srsmatrix< TR >, basic_srbmatrix< TR >, and basic_srmatrix< TR >.
Definition at line 11213 of file cvm.h.
|
inline |
Diagonal as l-value.
Operator provides access to nDiag-th
diagonal of calling matrix (here nDiag=0
for main diagonal, nDiag<0
for lower diagonals and nDiag>0
for upper ones) by returning rvector sharing memory with it. Operator throws cvmexception if nDiag
is outside of boundaries.
[in] | nDiag | Index of diagonal (0 for main diagonal, negative for lower, positive for upper one). |
|
inline |
Diagonal (not l-value)
Operator creates rvector object as a copy of nDiag-th
diagonal of calling matrix where nDiag=0
for main diagonal, nDiag<0
for lower diagonals and nDiag>0
for upper ones. Operator throws cvmexception if nDiag
is outside of boundaries.
[in] | nDiag | Index of diagonal (0 for main diagonal, negative for lower, positive for upper one). |
Reimplemented in basic_srsmatrix< TR >.
|
inline |
Assignment operator.
Sets every element of calling rmatrix to be equal to appropriate element of matrix m
and returns reference to the matrix changed. Operator throws cvmexception in case of different matrix dimensions.
[in] | m | rmatrix to assign from. |
Definition at line 11325 of file cvm.h.
|
inline |
Move assignment operator.
Implements move semantics introduced in new C++ standard. Moves data ownership from other matrix to calling object. It's usually executed implicitly in cases like this:
Here temporary result of calling b.operator+(c)
will not be destroyed but rather moved to calling object a
.
[in] | m | rvalue reference to other matrix. |
Definition at line 11346 of file cvm.h.
|
inline |
Vector (as array) assignment.
Sets every element of calling matrix to be equal to appropriate element of rvector v
as an array. Assignment is performed according to matrix storage (by columns). It's assumed that vector passed is long enough to fill calling matrix. Function throws cvmexception otherwise.
[in] | v | rvector to assign. |
Reimplemented in basic_srbmatrix< TR >, and basic_srmatrix< TR >.
Definition at line 11382 of file cvm.h.
|
inline |
External array assignment.
Sets every element of calling matrix to be equal to appropriate element of array pointed to by parameter pd
and returns reference to the matrix changed. Assignment is performed according to matrix storage (by columns). It's assumed that array passed is long enough to fill calling matrix.
[in] | pd | Const pointer to external array. |
Reimplemented from basic_array< TR, TR >.
Reimplemented in basic_srbmatrix< TR >, and basic_srmatrix< TR >.
|
inline |
Assignment to submatrix.
Sets submatrix of calling matrix beginning with row nRow
and column nCol
to matrix m
and returns reference to the matrix changed. Function throws cvmexception if nRow
or nCol
are not positive or matrix m
doesn't fit. Indexes are CVM0 based.
[in] | nRow | Row index (CVM0 based). |
[in] | nCol | Column index (CVM0 based). |
[in] | m | Reference to matrix to assign. |
Definition at line 11452 of file cvm.h.
|
inline |
Sets all elements to one value.
Sets every element of calling matrix to be equal to parameter d
and returns reference to the matrix changed.
[in] | d | Value to set to. |
Reimplemented from basic_array< TR, TR >.
Reimplemented in basic_srsmatrix< TR >, basic_srbmatrix< TR >, and basic_srmatrix< TR >.
Definition at line 11484 of file cvm.h.
|
inline |
Changes dimensions.
Changes dimensions of calling matrix to to nNewM
by nNewN
and returns reference to the matrix changed. In case of increasing of its size, the matrix is filled up with zeroes. Function throws cvmexception in case of negative dimension passed or memory allocation failure.
[in] | nNewM | New number of rows. |
[in] | nNewN | New number of columns. |
Definition at line 11533 of file cvm.h.
|
inline |
Matrix comparison.
Operator compares calling matrix with matrix m
and returns true
if they have same sizes and their appropriate elements differ by not more than cvmMachMin() (the smallest normalized positive number). Returns false
otherwise.
[in] | m | rmatrix to compare to. |
Definition at line 11565 of file cvm.h.
|
inline |
Matrix comparison.
Operator compares calling matrix with matrix m
and returns true
if they have different sizes or at least one of their appropriate elements differs by more than cvmMachMin() (the smallest normalized positive number). Returns false
otherwise.
[in] | m | rmatrix to compare to. |
Definition at line 11595 of file cvm.h.
|
inline |
Matrix replacement.
Destroys calling matrix, creates a new one as a copy of m
and returns reference to the matrix changed. Operator throws cvmexception in case of memory allocation failure.
[in] | m | rmatrix to replace by. |
|
inline |
Addition operator.
Creates object of type rmatrix as sum of calling matrix and matrix m
. Operator throws cvmexception in case of different sizes of the operands or memory allocation failure.
[in] | m | rmatrix to add to calling one. |
Definition at line 11682 of file cvm.h.
|
inline |
Subtraction operator.
Creates object of type rmatrix as difference of calling matrix and matrix m
. It throws cvmexception in case of different sizes of the operands or memory allocation failure.
[in] | m | rmatrix to subtract from calling one. |
Definition at line 11726 of file cvm.h.
|
inline |
Sum of matrices.
Assigns sum of matrices m1
and m2
to calling matrix and returns reference to the matrices changed. It throws cvmexception in case of different sizes of the operands.
Definition at line 11771 of file cvm.h.
|
inline |
Difference of matrices.
Assigns difference of matrices m1
and m2
to calling matrix and returns reference to the matrix changed. It throws cvmexception in case of different sizes of the operands.
Definition at line 11817 of file cvm.h.
|
inline |
Increment operator.
Adds matrix m
to calling matrix and returns reference to the matrix changed. It throws cvmexception in case of different sizes of the operands.
[in] | m | rmatrix to increment by. |
Definition at line 11866 of file cvm.h.
|
inline |
Decrement operator.
Subtracts matrix m
from calling matrix and returns reference to the matrix changed. It throws cvmexception in case of different sizes of the operands.
[in] | m | rmatrix to decrement by. |
Definition at line 11913 of file cvm.h.
|
inline |
Unary minus operator.
Creates object of type rmatrix as calling matrix multiplied by -1
. It throws cvmexception in case of memory allocation failure.
Reimplemented in basic_srsmatrix< TR >, basic_srbmatrix< TR >, and basic_srmatrix< TR >.
|
inline |
Multiply by number operator.
Creates object of type rmatrix as product of calling matrix and number dMult
. It throws cvmexception in case of memory allocation failure.
[in] | dMult | Number to multiply by. |
Reimplemented in basic_srsmatrix< TR >, basic_srbmatrix< TR >, and basic_srmatrix< TR >.
|
inline |
Divide by number operator.
Creates object of type rmatrix as quotient of calling matrix and number dDiv
. It throws cvmexception if dDiv
has absolute value equal or less than cvmMachMin() (the smallest normalized positive number). It also throws exception in case of memory allocation failure.
[in] | dDiv | Number to divide by. |
Reimplemented in basic_srsmatrix< TR >, basic_srbmatrix< TR >, and basic_srmatrix< TR >.
|
inline |
Multiply by number and assign.
Multiplies calling matrix by number dMult
and returns reference to the matrix changed.
[in] | dMult | Number to multiply by. |
Reimplemented in basic_srsmatrix< TR >, basic_srbmatrix< TR >, and basic_srmatrix< TR >.
|
inline |
Divide by number and assign.
Divides calling matrix by number dDiv
and returns reference to the matrix changed. It throws cvmexception if dDiv
has absolute value equal or less than cvmMachMin() (the smallest normalized positive number).
[in] | dDiv | Number to divide by. |
Reimplemented in basic_srsmatrix< TR >, basic_srbmatrix< TR >, and basic_srmatrix< TR >.
|
inline |
Matrix normalizer.
Normalizes calling matrix so its Euclidean norm() becomes equal to 1 if it was greater than cvmMachMin() (the smallest normalized positive number) before the call. Does nothing otherwise.
Reimplemented in basic_srsmatrix< TR >, basic_srbmatrix< TR >, and basic_srmatrix< TR >.
|
inline |
Matrix transposition.
Creates object of type rmatrix
as transposed calling matrix.
Reimplemented in basic_srsmatrix< TR >, basic_srbmatrix< TR >, and basic_srmatrix< TR >.
Definition at line 12139 of file cvm.h.
|
inline |
Matrix transposition.
Sets calling matrix to be equal to matrix m
transposed. Function throws cvmexception in case of not appropriate sizes of the operands.
[in] | m | rmatrix to transpose. |
Definition at line 12178 of file cvm.h.
|
inline |
Matrix transposition (in-place)
Makes calling matrix to be equal to transposed itself. Function throws cvmexception in case of memory allocation failure.
Reimplemented in basic_srsmatrix< TR >, basic_srbmatrix< TR >, and basic_srmatrix< TR >.
Definition at line 12220 of file cvm.h.
|
inline |
Matrix-vector product.
Creates object of type rvector as product of calling matrix and vector v
. Function throws cvmexception if the number of columns of the calling matrix differs from size of the vector v
. Use basic_rvector::mult(const basic_rmatrix<TR>&,const basic_rvector<TR>&) to avoid new object creation.
[in] | v | rvector to compute product with. |
Reimplemented in basic_srsmatrix< TR >, basic_srbmatrix< TR >, and basic_srmatrix< TR >.
Definition at line 12257 of file cvm.h.
|
inline |
Matrix-matrix product.
Creates object of type rmatrix as product of calling matrix and matrix m
. Operator throws cvmexception if number of columns of calling matrix differs from number of rows of the matrix m
. Use mult() to avoid new object creation.
[in] | m | rmatrix to compute product with. |
Definition at line 12294 of file cvm.h.
|
inline |
Matrix-matrix product.
Sets calling matrix to be equal to product of matrix m1
by matrix m2
and returns reference to the matrix changed. Function throws cvmexception in case of inappropriate sizes of the operands.
Definition at line 12336 of file cvm.h.
|
inline |
Rank-1 update.
Sets calling matrix to be a rank-1 update of vectors vCol
and vRow
. Function throws cvmexception if number of rows of calling matrix is not equal to size of vCol
or number of columns of calling matrix is not equal to size of vRow
. The rank-1 update of vector-column of size and vector-row of size is defined as matrix
Definition at line 12394 of file cvm.h.
|
inline |
Rows swap.
Swaps two rows of calling matrix and returns reference to the matrix changed. n1
and n2
are indexes of rows to be swapped, both are CVM0 based. Function throws cvmexception if one of the parameters is outside of boundaries.
[in] | n1 | Row index to swap. |
[in] | n2 | Row index to swap. |
Reimplemented in basic_srmatrix< TR >.
|
inline |
Columns swap.
Swaps two columnss of calling matrix and returns reference to the matrix changed. n1
and n2
are indexes of columns to be swapped, both are CVM0 based. Function throws cvmexception if one of the parameters is outside of boundaries.
[in] | n1 | Column index to swap. |
[in] | n2 | Column index to swap. |
Reimplemented in basic_srmatrix< TR >.
|
inline |
Linear solver.
Sets calling matrix to be equal to solution of matrix linear equation where parameter mA
is square matrix and parameter mB
is matrix . Function returns reference to the matrix changed. It also sets output parameter dErr
to be equal to the norm of computation error. Function throws cvmexception in case of inappropriate sizes of the operands or when the matrix is close to singular.
|
inline |
Linear solver (transposed)
Sets calling matrix to be equal to solution of matrix linear equation (which is equivalent to ) where parameter mA
is square matrix and parameter mB
is matrix . Function returns reference to the matrix changed. It also sets output parameter dErr
to be equal to the norm of computation error. Function throws cvmexception in case of inappropriate sizes of the operands or when the matrix is close to singular.
|
inline |
Linear solver.
Sets calling matrix to be equal to solution of matrix linear equation where parameter mA
is square matrix and parameter mB
is matrix . Function returns reference to the matrix changed. Function throws cvmexception in case of inappropriate sizes of the operands or when the matrix is close to singular.
Definition at line 12615 of file cvm.h.
|
inline |
Linear solver (transposed)
Sets calling matrix to be equal to solution of matrix linear equation (which is equivalent to ) where parameter mA
is square matrix and parameter mB
is matrix . Function returns reference to the matrix changed. Function throws cvmexception in case of inappropriate sizes of the operands or when the matrix is close to singular.
Definition at line 12666 of file cvm.h.
|
inline |
LU factorization based linear solver.
Sets calling matrix to be equal to solution of matrix linear equation where parameter mA
is square matrix , parameter mLU
is LU factorization (see srmatrix::low_up() ) of matrix , parameter pPivots
is an array of pivot numbers created while factorizing matrix and parameter mB
is matrix . Function returns reference to the matrix changed. It also sets output parameter dErr
to be equal to the norm of computation error. This function is useful when you need to solve few linear equations of kind with the same matrix and different matrices . In such case you save on matrix factorization since it's needed to be performed just one time. Throws cvmexception in case of inappropriate sizes of the objects or when matrix is close to singular.
[in] | mA | srmatrix . |
[in] | mLU | LU factorization of matrix . |
[in] | pPivots | pivots vector. |
[in] | mB | rmatrix . |
[out] | dErr | Norm of computation error. |
Definition at line 12741 of file cvm.h.
|
inline |
LU factorization based linear solver.
Sets calling matrix to be equal to solution of matrix linear equation where parameter mA
is square matrix , parameter mLU
is LU factorization (see srmatrix::low_up() ) of matrix , parameter pPivots
is an array of pivot numbers created while factorizing matrix and parameter mB
is matrix . Function returns reference to the matrix changed. This function is useful when you need to solve few linear equations of kind with the same matrix and different matrices . In such case you save on matrix factorization since it's needed to be performed just one time. Throws cvmexception in case of inappropriate sizes of the objects or when matrix is close to singular.
[in] | mA | srmatrix . |
[in] | mLU | LU factorization of matrix . |
[in] | pPivots | pivots vector. |
[in] | mB | rmatrix . |
Definition at line 12818 of file cvm.h.
|
inline |
Singular value decomposition.
Creates rvector of singular values
of real matrix (calling matrix). These values are the main diagonal of matrix of the singular value decomposition
where and are orthogonal for real and unitary for complex . is transposed for real one and hermitian conjugated for complex one. First columns of matrices and are left and right singular vectors of respectively. Singular values and singular vectors satisfy
where and are -th columns of and respectively. Function throws cvmexception in case of convergence error.
Definition at line 12867 of file cvm.h.
|
inline |
Singular value decomposition.
Creates rvector of singular values
of real matrix (calling matrix). These values are the main diagonal of matrix of the singular value decomposition
where and are orthogonal for real and unitary for complex . is transposed for real one and hermitian conjugated for complex one. First columns of matrices and are left and right singular vectors of respectively. Singular values and singular vectors satisfy
where and are -th columns of and respectively. Function sets output parameter mU
to be equal to square matrix of size and mVH
to be equal to square matrix of size . Function throws cvmexception in case of inappropriate calling object size (it must be equal to ), matrix mU
size (must be ), matrix mVH
size (must be ) or in case of convergence error.
Definition at line 12949 of file cvm.h.
|
inline |
Pseudo (generalized) inversion.
Creates object of type rmatrix as pseudo inverted calling matrix. Matrix pseudo inversion (aka Moore-Penrose generalized inversion) definition: matrix is pseudo inversion of matrix if the following two equations are satisfied:
where and are some matrices. To compute the pseudo inversion, we use singular value decomposition
of matrix , thus
where is diagonal matrix having inverted diagonal values of matrix if they are greater than some threshold, and zeros otherwise. The threshold
parameter sets minimum distinguishable from zero singular value to be used to compute the pseudo inversion. All values equal or less than the threshold are treated as zeros. Function throws cvmexception in case of memory allocation failure.
[in] | threshold | Algorithm threshold. |
Definition at line 13009 of file cvm.h.
|
inline |
Pseudo (generalized) inversion.
Sets calling matrix to be equal to matrix mA
pseudo inverted. Matrix pseudo inversion (aka Moore-Penrose generalized inversion) definition: matrix is pseudo inversion of matrix if the following two equations are satisfied:
where and are some matrices. To compute the pseudo inversion, we use singular value decomposition
of matrix , thus
where is diagonal matrix having inverted diagonal values of matrix if they are greater than some threshold, and zeros otherwise. The threshold
parameter sets minimum distinguishable from zero singular value to be used to compute the pseudo inversion. All values equal or less than the threshold are treated as zeros. Function throws cvmexception in case of not appropriate sizes of the operands.
[in] | mA | Matrix to pseudo invert. |
[in] | threshold | Algorithm threshold. |
Definition at line 13073 of file cvm.h.
|
inline |
Overdetermined or underdetermined linear solver.
Creates object of type rmatrix as a solution of overdetermined or underdetermined linear systems
for matrix (or transposed one) where is a vector of length combined to
for multiple vectors stored as columns of matrix where in non-transposed case and otherwise. The algorithm uses QR or LQ factorization of . It is assumed that has full rank, infinity returned otherwise. Internally function uses DGELS
LAPACK routines. If and transpose=false
or and transpose=true
, then the system is overdetermined, thus the algorithm tries to find the least squares solution of the problem
respectively. Real number dErr
(or vector vErr
for multiple vector case) returns residual sum of squares. The system is underdetermined otherwise, and the algorithm finds its minimum norm solution. In this case bErr
is set to zero. In both cases the solution computed satisfies , but this algorithm is faster than pseudo inversion. Function throws cvmexception in case of inappropriate sizes of the operands.
[in] | transpose | True to compute for transposed matrix (calling matrix). |
[in] | mB | rmatrix . |
[out] | vErr | Norms of computation errors. |
Definition at line 13146 of file cvm.h.
|
inline |
Overdetermined or underdetermined linear solver.
Sets calling matrix to a solution of overdetermined or underdetermined linear systems
for matrix (or transposed one, parameter mA
) where is a vector of length combined to
for multiple vectors stored as columns of matrix where in non-transposed case and otherwise. The algorithm uses QR or LQ factorization of . It is assumed that has full rank, infinity returned otherwise. Internally function uses DGELS
LAPACK routines. If and transpose=false
or and transpose=true
, then the system is overdetermined, thus the algorithm tries to find the least squares solution of the problem
respectively. Real number dErr
(or vector vErr
for multiple vector case) returns residual sum of squares. The system is underdetermined otherwise, and the algorithm finds its minimum norm solution. In this case bErr
is set to zero. In both cases the solution computed satisfies , but this algorithm is faster than pseudo inversion. Function throws cvmexception in case of inappropriate sizes of the operands.
[in] | transpose | True to compute for transposed matrix (calling matrix). |
[in] | mA | rmatrix . |
[in] | mB | rmatrix . |
[out] | vErr | Norms of computation errors. |
Definition at line 13222 of file cvm.h.
|
inline |
Overdetermined or underdetermined linear solver.
Creates object of type rvector as a solution of overdetermined or underdetermined linear system
for matrix (or transposed one) where is a vector of length where in non-transposed case and otherwise. The algorithm uses QR or LQ factorization of . It is assumed that has full rank, infinity returned otherwise. Internally function uses DGELS
LAPACK routines. If and transpose=false
or and transpose=true
, then the system is overdetermined, thus the algorithm tries to find the least squares solution of the problem
respectively. Real number dErr
returns residual sum of squares. The system is underdetermined otherwise, and the algorithm finds its minimum norm solution. In this case bErr
is set to zero. In both cases the solution computed satisfies , but this algorithm is faster than pseudo inversion. Function throws cvmexception in case of inappropriate sizes of the operands.
[in] | transpose | True to compute for transposed matrix (calling matrix). |
[in] | vB | rvector . |
[out] | dErr | Norm of computation error. |
Definition at line 13295 of file cvm.h.
|
inline |
Linear least squares problem.
Function creates rmatrix object with the minimum-norm solutions to linear least squares problems
using complete orthogonal factorization of calling matrix . Here is a vector of length . Multiple vectors are stored as columns of matrix . Matrix may be rank-deficient, function returns its effective rank in rank
output parameter using tol
tolerance. Internally function uses DGELSY
LAPACK routines, see more details about the algorithm in those routines' documentation. It throws cvmexception in case of inappropriate sizes of the operands.
[in] | mB | rmatrix . |
[out] | rank | Rank of matrix . |
[in] | tol | Rank computation tolerance. |
Definition at line 13360 of file cvm.h.
|
inline |
Linear least squares problem.
Function sets calling matrix to the minimum-norm solutions to linear least squares problems
using complete orthogonal factorization of matrix (parameter mA
). Here is a vector of length . Multiple vectors are stored as columns of matrix . Matrix may be rank-deficient, function returns its effective rank in rank
output parameter using tol
tolerance. Internally function uses DGELSY
LAPACK routines, see more details about the algorithm in those routines' documentation. Matrix is passed as argument mA
. It throws cvmexception in case of inappropriate sizes of the operands.
[in] | mA | rmatrix . |
[in] | mB | rmatrix . |
[out] | rank | Rank of matrix . |
[in] | tol | Rank computation tolerance. |
Definition at line 13424 of file cvm.h.
|
inline |
Linear least squares problem.
Function creates rvector object with the minimum-norm solution to linear least squares problem
using complete orthogonal factorization of calling matrix . Here is a vector of length . Matrix may be rank-deficient, function returns its effective rank in rank
output parameter using tol
tolerance. Internally function uses DGELSY
LAPACK routines, see more details about the algorithm in those routines' documentation. Matrix is passed as argument mA
. It throws cvmexception in case of inappropriate sizes of the operands.
[in] | vB | rvector . |
[out] | rank | Rank of matrix . |
[in] | tol | Rank computation tolerance. |
Definition at line 13487 of file cvm.h.
|
inline |
Linear least squares problem.
Function creates rmatrix object with the minimum-norm solutions to linear least squares problems
using singular value decomposition of calling matrix . Here is a vector of length . Multiple vectors are stored as columns of matrix . Matrix may be rank-deficient, function returns its effective rank in rank
output parameter using tol
tolerance. Internally function uses DGELSY
LAPACK routines, see more details about the algorithm in those routines' documentation. Function also computes singular values of in decreasing order and returns them in sv
output parameter having size. It throws cvmexception in case of inappropriate sizes of the operands.
[in] | mB | rmatrix . |
[out] | sv | Singular values of . |
[out] | rank | Rank of matrix . |
[in] | tol | Rank computation tolerance. |
|
inline |
Linear least squares problem.
Function sets calling matrix to the minimum-norm solutions to linear least squares problems
using singular value decomposition of matrix (parameter mA
). Here is a vector of length . Multiple vectors are stored as columns of matrix . Matrix may be rank-deficient, function returns its effective rank in rank
output parameter using tol
tolerance. Internally function uses DGELSY
LAPACK routines, see more details about the algorithm in those routines' documentation. Matrix is passed as argument mA
. Function also computes singular values of in decreasing order and returns them in sv
output parameter having size. It throws cvmexception in case of inappropriate sizes of the operands.
[in] | mA | rmatrix . |
[in] | mB | rmatrix . |
[out] | sv | Singular values of . |
[out] | rank | Rank of matrix . |
[in] | tol | Rank computation tolerance. |
|
inline |
Linear least squares problem.
Function creates rvector object with the minimum-norm solution to linear least squares problem
using singular value decomposition of calling matrix . Here is a vector of length . Matrix may be rank-deficient, function returns its effective rank in rank
output parameter using tol
tolerance. Internally function uses DGELSY
LAPACK routines, see more details about the algorithm in those routines' documentation. Matrix is passed as argument mA
. Function also computes singular values of in decreasing order and returns them in sv
output parameter having size. It throws cvmexception in case of inappropriate sizes of the operands.
[in] | vB | rvector . |
[out] | sv | Singular values of . |
[out] | rank | Rank of matrix . |
[in] | tol | Rank computation tolerance. |
|
inline |
Linear least squares problem.
Function creates rmatrix object with the minimum-norm solutions to linear least squares problems
using singular value decomposition of calling matrix and divide and conquer method. Here is a vector of length . Multiple vectors are stored as columns of matrix . Matrix may be rank-deficient, function returns its effective rank in rank
output parameter using tol
tolerance. Internally function uses DGELSY
LAPACK routines, see more details about the algorithm in those routines' documentation. Function also computes singular values of in decreasing order and returns them in sv
output parameter having size. It throws cvmexception in case of inappropriate sizes of the operands.
[in] | mB | rmatrix . |
[out] | sv | Singular values of . |
[out] | rank | Rank of matrix . |
[in] | tol | Rank computation tolerance. |
|
inline |
Linear least squares problem.
Function sets calling matrix to the minimum-norm solutions to linear least squares problems
using singular value decomposition of matrix (parameter mA
) and divide and conquer method. Here is a vector of length . Multiple vectors are stored as columns of matrix . Matrix may be rank-deficient, function returns its effective rank in rank
output parameter using tol
tolerance. Internally function uses DGELSY
LAPACK routines, see more details about the algorithm in those routines' documentation. Matrix is passed as argument mA
. Function also computes singular values of in decreasing order and returns them in sv
output parameter having size. It throws cvmexception in case of inappropriate sizes of the operands.
[in] | mA | rmatrix . |
[in] | mB | rmatrix . |
[out] | sv | Singular values of . |
[out] | rank | Rank of matrix . |
[in] | tol | Rank computation tolerance. |
|
inline |
Linear least squares problem.
Function creates rvector object with the minimum-norm solution to linear least squares problem
using singular value decomposition of calling matrix and divide and conquer method. Here is a vector of length . Matrix may be rank-deficient, function returns its effective rank in rank
output parameter using tol
tolerance. Internally function uses DGELSY
LAPACK routines, see more details about the algorithm in those routines' documentation. Matrix is passed as argument mA
. Function also computes singular values of in decreasing order and returns them in sv
output parameter having size. It throws cvmexception in case of inappropriate sizes of the operands.
[in] | vB | rvector . |
[out] | sv | Singular values of . |
[out] | rank | Rank of matrix . |
[in] | tol | Rank computation tolerance. |
|
inline |
Matrix rank.
Returns rank of calling matrix as number of singular values with normalized absolute value greater than or equal to parameter tol
(this is the largest relative spacing by default). Function throws cvmexception in case of convergence error.
[in] | tol | Rank computation tolerance. |
Definition at line 13927 of file cvm.h.
|
inline |
QR factorization ("economy" mode)
Computes QR factorization as
where is calling matrix, orthogonal matrix and upper triangular (trapezoidal) matrix are mQ
and mR
output parameters respectively. This version implements so-called "economy" algorithm which for given matrix computes matrix and matrix . See also full version. Function throws cvmexception in case if inappropriate sizes of the operands passed.
|
inline |
QR factorization ("full" mode)
Computes QR factorization as
where is calling matrix, orthogonal matrix and upper triangular (trapezoidal) matrix are mQ
and mR
output parameters respectively. This version implements so-called "full" algorithm which for given matrix computes matrix and matrix . See also economy version. Function throws cvmexception in case if inappropriate sizes of the operands passed.
|
inline |
LQ factorization ("economy" mode)
Computes LQ factorization as
where is calling matrix, lower triangular (trapezoidal) matrix and orthogonal matrix are mL
and mQ
output parameters respectively. This version implements so-called "economy" algorithm which for given matrix computes matrix and matrix . See also full version. Function throws cvmexception in case of inappropriate sizes of the operands passed.
|
inline |
LQ factorization ("full" mode)
Computes LQ factorization as
where is calling matrix, lower triangular (trapezoidal) matrix and orthogonal matrix are mL
and mQ
output parameters respectively. This version implements so-called "full" algorithm which for given matrix computes matrix and matrix . See also economy version. Function throws cvmexception in case of inappropriate sizes of the operands passed.
|
inline |
RQ factorization ("economy" mode)
Computes RQ factorization as
where is calling matrix, upper triangular matrix and orthogonal matrix are mR
and mQ
output parameters respectively. This version implements so-called "economy" algorithm which for given matrix computes matrix and matrix . See also full version. Following this definition the implementation assumes that is satisfied and throws cvmexception otherwise. Function also throws cvmexception in case of inappropriate sizes of the operands passed.
|
inline |
RQ factorization ("full" mode)
Computes RQ factorization as
where is calling matrix, upper triangular matrix and orthogonal matrix are mR
and mQ
output parameters respectively. This version implements so-called "full" algorithm which for given matrix computes matrix and matrix . See also economy version. Following this definition the implementation assumes that is satisfied and throws cvmexception otherwise. Function also throws cvmexception in case of inappropriate sizes of the operands passed.
|
inline |
QL factorization ("economy" mode)
Computes QL factorization as
where is calling matrix, orthogonal matrix and lower triangular matrix are mQ
and mL
output parameters respectively. This version implements so-called "economy" algorithm which for given matrix computes matrix and matrix . See also full version. Following this definition the implementation assumes that is satisfied and throws cvmexception otherwise. Function also throws cvmexception in case of inappropriate sizes of the operands passed.
|
inline |
QL factorization ("full" mode)
Computes QL factorization as
where is calling matrix, orthogonal matrix and lower triangular matrix are mQ
and mL
output parameters respectively. This version implements so-called "full" algorithm which for given matrix computes matrix and matrix . See also economy version. Following this definition the implementation assumes that is satisfied and throws cvmexception otherwise. Function also throws cvmexception in case of inappropriate sizes of the operands passed.
|
inline |
Rank-1 update matrix-vector operation.
Calls one of DGER
routines of the BLAS
library performing rank-1 update matrix-vector operation defined as
where is real number (parameter alpha
), is calling matrix and and are real vectors (parameters vCol
and vRow
respectively). Function returns reference to the matrix changed and throws cvmexception in case of inappropriate sizes of the operands. Function is not applicable to objects of the classes srbmatrix and srsmatrix (i.e. cvmexception would be thrown).
Definition at line 14392 of file cvm.h.
|
inline |
Generic matrix-matrix operation.
Calls one of DGEMM
routines of the BLAS library performing matrix-matrix operation defined as
where and are real numbers (parameters dAlpha
and dBeta
), is calling matrix and and are matrices (parameters m1
and m2
respectively). Function transposes matrix if appropriate boolean parameter bTrans*
is equal to true
and does nothing otherwise. Function returns reference to the matrix changed and throws cvmexception in case of inappropriate sizes of the operands. Function is not applicable to objects of the classes srbmatrix and srsmatrix (i.e. exception of type cvmexception would be thrown).
[in] | m1 | rmatrix . |
[in] | bTrans1 | Transpose rmatrix . |
[in] | m2 | rmatrix . |
[in] | bTrans2 | Transpose rmatrix . |
[in] | dAlpha | Multiplier . |
[in] | dBeta | Multiplier . |
Definition at line 14458 of file cvm.h.
|
inline |
Generic symmetric matrix-matrix operation.
Calls one of DSYMM
routines of the BLAS library performing one of matrix-matrix operations defined as
where and are real numbers (parameters dAlpha
and dBeta
), is calling matrix, is symmetric matrix and is real matrix (parameters ms
and m
respectively). First operation is performed if bLeft
passed is true
and second one otherwise. Function returns reference to the matrix changed and throws cvmexception in case of inappropriate sizes of the operands. Function is not applicable to objects of the class srbmatrix (i.e. cvmexception would be thrown).
[in] | bLeft | Perfoem left-side operation. |
[in] | ms | srsmatrix . |
[in] | m | rmatrix . |
[in] | dAlpha | Multiplier . |
[in] | dBeta | Multiplier . |
Definition at line 14541 of file cvm.h.
|
inline |
Set matrix to zero.
Sets every element of calling matrix to be equal to zero and returns reference to the matrix changed. This function is faster than, for example, set(TR) with zero parameter passed.
Reimplemented in basic_srsmatrix< TR >, basic_srbmatrix< TR >, and basic_srmatrix< TR >.
Definition at line 14580 of file cvm.h.
|
inline |
Fills calling matrix with pseudo-random numbers distributed between dFrom
and dTo
. Function returns reference to the matrix changed.
[in] | dFrom | First limit. |
[in] | dTo | Second limit. |
Reimplemented in basic_srsmatrix< TR >, basic_srbmatrix< TR >, and basic_srmatrix< TR >.
|
inlineoverridevirtual |
2-norm
2-norm of calling array that for vectors is defined as
and for matrices as
where is -th singular value of matrix .
Reimplemented from basic_array< TR, TR >.
Definition at line 14618 of file cvm.h.
|
friend |