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 square matrix of real numbers. More...
#include <cvm.h>
Public Member Functions | |
basic_srmatrix () | |
Default constructor. | |
basic_srmatrix (tint nDim) | |
Constructor. | |
basic_srmatrix (TR *pd, tint nDim) | |
Constructor. | |
basic_srmatrix (const TR *pd, tint nDim) | |
Constructor. | |
basic_srmatrix (const basic_srmatrix &m) | |
Copy constructor. | |
basic_srmatrix (basic_srmatrix &&m) noexcept | |
Move constructor. | |
basic_srmatrix (const BaseRMatrix &m) | |
Constructor. | |
basic_srmatrix (const RVector &v) | |
Constructor. | |
basic_srmatrix (BaseRMatrix &m, tint nRow, tint nCol, tint nDim) | |
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. | |
const RVector | operator() (tint nCol) const throw (cvmexception) |
Column as not l-value. | |
RVector | operator[] (tint nRow) throw (cvmexception) |
Row as l-value. | |
const RVector | operator[] (tint nRow) const throw (cvmexception) |
Row as not l-value. | |
basic_srmatrix & | operator= (const basic_srmatrix &m) throw (cvmexception) |
Assignment operator. | |
basic_srmatrix & | operator= (basic_srmatrix &&m) throw (cvmexception) |
Move assignment operator. | |
basic_srmatrix & | assign (const RVector &v) throw (cvmexception) |
Vector (as array) assignment. | |
basic_srmatrix & | assign (const TR *pd) |
External array assignment. | |
basic_srmatrix & | assign (tint nRow, tint nCol, const BaseRMatrix &m) throw (cvmexception) |
Assignment to submatrix. | |
basic_srmatrix & | set (TR d) |
Sets all elements to one value. | |
basic_srmatrix & | resize (tint nNewDim) throw (cvmexception) |
Changes dimension. | |
basic_srmatrix & | operator<< (const basic_srmatrix &m) throw (cvmexception) |
Matrix replacement. | |
basic_srmatrix | operator+ (const basic_srmatrix &m) const throw (cvmexception) |
Addition operator. | |
basic_srmatrix | operator- (const basic_srmatrix &m) const throw (cvmexception) |
Subtraction operator. | |
basic_srmatrix & | sum (const basic_srmatrix &m1, const basic_srmatrix &m2) throw (cvmexception) |
Sum of matrices. | |
basic_srmatrix & | diff (const basic_srmatrix &m1, const basic_srmatrix &m2) throw (cvmexception) |
Difference of matrices. | |
basic_srmatrix & | operator+= (const basic_srmatrix &m) throw (cvmexception) |
Increment operator. | |
basic_srmatrix & | operator-= (const basic_srmatrix &m) throw (cvmexception) |
Decrement operator. | |
basic_srmatrix | operator- () const |
Unary minus operator. | |
basic_srmatrix & | operator++ () |
Plus identity, prefix. | |
basic_srmatrix | operator++ (int) |
Plus identity, postfix. | |
basic_srmatrix & | operator-- () |
Minus identity, prefix. | |
basic_srmatrix | operator-- (int) |
Minus identity, postfix. | |
basic_srmatrix | operator* (TR dMult) const |
Multiply by number operator. | |
basic_srmatrix | operator/ (TR dDiv) const throw (cvmexception) |
Divide by number operator. | |
basic_srmatrix & | operator*= (TR dMult) |
Multiply by number and assign. | |
basic_srmatrix & | operator/= (TR dDiv) |
Divide by number and assign. | |
basic_srmatrix & | normalize () |
Matrix normalizer. | |
basic_srmatrix | operator~ () const throw (cvmexception) |
Matrix transposition. | |
basic_srmatrix & | transpose (const basic_srmatrix &m) throw (cvmexception) |
Matrix transposition. | |
basic_srmatrix & | transpose () |
Matrix transposition (in-place) | |
RVector | operator* (const RVector &v) const throw (cvmexception) |
Matrix-vector product. | |
BaseRMatrix | operator* (const BaseRMatrix &m) const throw (cvmexception) |
Matrix-matrix product. | |
basic_srmatrix | operator* (const basic_srmatrix &m) const throw (cvmexception) |
Matrix-matrix product. | |
basic_srmatrix & | operator*= (const basic_srmatrix &m) throw (cvmexception) |
Matrix-matrix product with assignment. | |
basic_srmatrix & | swap_rows (tint n1, tint n2) throw (cvmexception) |
Rows swap. | |
basic_srmatrix & | swap_cols (tint n1, tint n2) throw (cvmexception) |
Columns swap. | |
RVector | solve (const RVector &vB, TR &dErr) const throw (cvmexception) |
Linear solver. | |
RVector | solve_tran (const RVector &vB, TR &dErr) const throw (cvmexception) |
Linear solver (transposed) | |
RVector | solve (const RVector &vB) const throw (cvmexception) |
Linear solver. | |
RVector | solve_tran (const RVector &vB) const throw (cvmexception) |
Linear solver (transposed) | |
BaseRMatrix | solve (const BaseRMatrix &mB, TR &dErr) const throw (cvmexception) |
Linear solver. | |
BaseRMatrix | solve_tran (const BaseRMatrix &mB, TR &dErr) const throw (cvmexception) |
Linear solver (transposed) | |
BaseRMatrix | solve (const BaseRMatrix &mB) const throw (cvmexception) |
Linear solver. | |
BaseRMatrix | solve_tran (const BaseRMatrix &mB) const throw (cvmexception) |
Linear solver (transposed) | |
RVector | operator% (const RVector &vB) const throw (cvmexception) |
Linear solver operator (transposed) | |
RVector | operator/ (const RVector &vB) const throw (cvmexception) |
Linear solver operator. | |
RVector | solve_lu (const basic_srmatrix &mLU, const tint *pPivots, const RVector &vB, TR &dErr) const throw (cvmexception) |
LU factorization based linear solver. | |
RVector | solve_lu (const basic_srmatrix &mLU, const tint *pPivots, const RVector &vB) const throw (cvmexception) |
LU factorization based linear solver. | |
BaseRMatrix | solve_lu (const basic_srmatrix &mLU, const tint *pPivots, const BaseRMatrix &mB, TR &dErr) const throw (cvmexception) |
LU factorization based linear solver. | |
BaseRMatrix | solve_lu (const basic_srmatrix &mLU, const tint *pPivots, const BaseRMatrix &mB) const throw (cvmexception) |
LU factorization based linear solver. | |
TR | det () const throw (cvmexception) |
Matrix determinant. | |
basic_srmatrix & | low_up (const basic_srmatrix &m, tint *nPivots) throw (cvmexception) |
Low-up (LU) factorization. | |
basic_srmatrix | low_up (tint *nPivots) const throw (cvmexception) |
Low-up (LU) factorization. | |
TR | cond () const throw (cvmexception) |
Condition number reciprocal. | |
basic_srmatrix & | inv (const basic_srmatrix &m) throw (cvmexception) |
Matrix inversion. | |
basic_srmatrix | inv () const throw (cvmexception) |
Matrix inversion. | |
basic_srmatrix & | exp (const basic_srmatrix &m, TR tol=basic_cvmMachSp< TR >()) throw (cvmexception) |
Matrix exponent. | |
basic_srmatrix | exp (TR tol=basic_cvmMachSp< TR >()) const throw (cvmexception) |
Matrix exponent. | |
basic_srmatrix & | polynom (const basic_srmatrix &m, const RVector &v) throw (cvmexception) |
Matrix polynomial. | |
basic_srmatrix | polynom (const RVector &v) const |
Matrix polynomial. | |
CVector | eig (basic_scmatrix< TR, TC > &mEigVect, bool bRightVect=true) const throw (cvmexception) |
Eigenvalues and eigenvectors. | |
CVector | eig () const throw (cvmexception) |
Eigenvalues. | |
basic_srmatrix & | cholesky (const basic_srsmatrix< TR > &m) throw (cvmexception) |
Cholesky factorization. | |
basic_srmatrix & | bunch_kaufman (const basic_srsmatrix< TR > &m, tint *nPivots) throw (cvmexception) |
Bunch-Kaufman factorization. | |
void | qr (basic_srmatrix< TR > &mQ, basic_srmatrix< TR > &mR) const throw (cvmexception) |
QR factorization. | |
void | lq (basic_srmatrix< TR > &mL, basic_srmatrix< TR > &mQ) const throw (cvmexception) |
LQ factorization. | |
void | ql (basic_srmatrix< TR > &mQ, basic_srmatrix< TR > &mL) const throw (cvmexception) |
QL factorization. | |
void | rq (basic_srmatrix< TR > &mR, basic_srmatrix< TR > &mQ) const throw (cvmexception) |
RQ factorization. | |
basic_srmatrix & | identity () |
Identity matrix. | |
basic_srmatrix & | vanish () |
Set matrix to zero. | |
basic_srmatrix & | randomize (TR dFrom, TR dTo) |
Randomizer. | |
Public Member Functions inherited from basic_rmatrix< TR > | |
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. | |
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 (tint nRow, tint nCol, const basic_rmatrix &m) throw (cvmexception) |
Assignment to submatrix. | |
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 & | transpose (const basic_rmatrix &m) throw (cvmexception) |
Matrix transposition. | |
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 & | 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. | |
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 | |
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 |
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 Member Functions inherited from SqMatrix< TR, TR > | |
SqMatrix () | |
internal constructor | |
virtual | ~SqMatrix () |
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 square matrix of real numbers.
TR
type stands for treal. Please use predefined srmatrix class in your applications.
|
inline |
|
inlineexplicit |
Constructor.
Creates srmatrix object where is passed in nDim
parameter. Constructor sets all elements to zero. It throws cvmexception in case of non-positive size passed or memory allocation failure. Example:
prints
[in] | nDim | Number of rows and columns. |
|
inline |
Constructor.
Creates srmatrix object where is passed in nDim
parameter. It throws cvmexception in case of non-positive size 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] | nDim | Number of rows and columns. |
|
inline |
Constructor.
Creates srmatrix object where is passed in nDim
parameter. 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 nDim*nDim
elements total. Example:
prints
[in] | pd | Const pointer to external array. |
[in] | nDim | Number of rows and columns. |
|
inline |
Copy constructor.
Creates srmatrix object as a copy of matrix m
. It throws cvmexception in case of memory allocation failure.
[in] | m | srmatrix 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. |
|
inline |
Constructor.
Creates srmatrix object as a copy of matrix m
. It's assumed that matrix m
must have equal sizes, i.e. is satisfied. Constructor throws cvmexception if this is not true or in case of memory allocation failure. Please note that this constructor is not explicit.
[in] | m | rmatrix to copy from. |
Definition at line 15169 of file cvm.h.
|
inlineexplicit |
Constructor.
Creates srmatrix object of size v.size()
by v.size()
and assigns vector v
to its main diagonal. Constructor throws cvmexception in case of memory allocation failure.
[in] | v | rvector to copy main diagonal from. |
Definition at line 15201 of file cvm.h.
|
inline |
Submatrix constructor.
Creates srmatrix object as submatrix of matrix m
. It means that the 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 dimension (parameter nDim
).
|
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 from basic_rmatrix< TR >.
Reimplemented in basic_srbmatrix< TR >.
Definition at line 15241 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 from basic_rmatrix< TR >.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
Definition at line 15248 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_rmatrix< TR >.
Definition at line 15256 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_rmatrix< TR >.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
Definition at line 15263 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_rmatrix< TR >.
Definition at line 15270 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_rmatrix< TR >.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
Definition at line 15277 of file cvm.h.
|
inline |
Assignment operator.
Sets every element of calling srmatrix to be equal to appropriate element of smatrix m
and returns reference to the matrix changed. Operator throws cvmexception in case of different matrix dimensions.
[in] | m | srmatrix to assign from. |
Definition at line 15316 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 15336 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 from basic_rmatrix< TR >.
Reimplemented in basic_srbmatrix< TR >.
Definition at line 15344 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_rmatrix< TR >.
Reimplemented in basic_srbmatrix< 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 rmatrix to assign. |
Definition at line 15389 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_rmatrix< TR >.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
Definition at line 15400 of file cvm.h.
|
inline |
Changes dimension.
Changes dimension of calling square matrix to nNewDim
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] | nNewDim | New dimension. |
Reimplemented from basic_array< TR, TR >.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
|
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 | srmatrix to replace by. |
|
inline |
Addition operator.
Creates object of type srmatrix 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 | srmatrix to add to calling one. |
Definition at line 15530 of file cvm.h.
|
inline |
Subtraction operator.
Creates object of type srmatrix 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 | srmatrix to subtract from calling one. |
Definition at line 15573 of file cvm.h.
|
inline |
Sum of matrices.
Assigns sum of square 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 15618 of file cvm.h.
|
inline |
Difference of matrices.
Assigns difference of square 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 15663 of file cvm.h.
|
inline |
Increment operator.
Adds srmatrix m
to calling matrix and returns reference to the matrix changed. It throws cvmexception in case of different sizes of the operands.
[in] | m | srmatrix to increment by. |
Definition at line 15710 of file cvm.h.
|
inline |
Decrement operator.
Subtracts srmatrix m
from calling matrix and returns reference to the matrix changed. It throws cvmexception in case of different sizes of the operands.
[in] | m | srmatrix to decrement by. |
Definition at line 15758 of file cvm.h.
|
inline |
Unary minus operator.
Creates object of type srmatrix as calling matrix multiplied by -1
. It throws cvmexception in case of memory allocation failure.
Reimplemented from basic_rmatrix< TR >.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
|
inline |
Plus identity, prefix.
Adds identity matrix to calling square matrix and returns reference to the matrix changed.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
|
inline |
Plus identity, postfix.
Adds identity matrix to calling square matrix and returns reference to the matrix changed.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
|
inline |
Minus identity, prefix.
Subtracts identity matrix from calling square matrix and returns reference to the matrix changed.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
|
inline |
Minus identity, postfix.
Subtracts identity matrix from calling square matrix and returns reference to the matrix changed.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
|
inline |
Multiply by number operator.
Creates object of type srmatrix as product of calling square matrix and number dMult
. It throws cvmexception in case of memory allocation failure.
[in] | dMult | Number to multiply by. |
Reimplemented from basic_rmatrix< TR >.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
|
inline |
Divide by number operator.
Creates object of type srmatrix as quotient of calling square 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 from basic_rmatrix< TR >.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< 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 from basic_rmatrix< TR >.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< 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 from basic_rmatrix< TR >.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< 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 from basic_rmatrix< TR >.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
|
inline |
Matrix transposition.
Creates object of type srmatrix
as transposed calling matrix.
Reimplemented from basic_rmatrix< TR >.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
Definition at line 16040 of file cvm.h.
|
inline |
Matrix transposition.
Sets calling matrix to be equal to square matrix m
transposed. Function throws cvmexception in case of not appropriate sizes of the operands.
[in] | m | srmatrix to transpose. |
Definition at line 16085 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 from basic_rmatrix< TR >.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
|
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 from basic_rmatrix< TR >.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
Definition at line 16097 of file cvm.h.
|
inline |
Matrix-matrix product.
Creates object of type rmatrix as product of calling square 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. |
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
Definition at line 16132 of file cvm.h.
|
inline |
Matrix-matrix product.
Creates object of type srmatrix as product of calling matrix and square 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 | srmatrix to compute product with. |
Definition at line 16166 of file cvm.h.
|
inline |
Matrix-matrix product with assignment.
Sets calling matrix to be equal to product of itself and square matrix m
and returns reference to the object it changes. Operator throws cvmexception in case of different dimensions of the operands.
[in] | m | srmatrix to compute product with. |
Definition at line 16210 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 from basic_rmatrix< 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 from basic_rmatrix< TR >.
|
inline |
Linear solver.
Creates rvector object as solution of linear equation where calling matrix is square matrix and parameter vB
is vector . 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 objects or when matrix is close to singular.
[in] | vB | rvector . |
[out] | dErr | Norm of computation error. |
|
inline |
Linear solver (transposed)
Creates rvector object as solution of linear equation (which is equivalent to ) where calling matrix is square matrix and parameter vB
is vector . 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 objects or when matrix is close to singular.
[in] | vB | rvector . |
[out] | dErr | Norm of computation error. |
|
inline |
Linear solver.
Creates rvector object as solution of linear equation where calling matrix is square matrix and parameter vB
is vector . Function throws cvmexception in case of inappropriate sizes of the objects or when matrix is close to singular.
[in] | vB | rvector . |
|
inline |
Linear solver (transposed)
Creates rvector object as solution of linear equation (which is equivalent to ) where calling matrix is square matrix and parameter vB
is vector . Function throws cvmexception in case of inappropriate sizes of the objects or when matrix is close to singular.
[in] | vB | rvector . |
|
inline |
Linear solver.
Creates rmatrix object as solution of matrix linear equation where calling square matrix is matrix and parameter mB
is matrix . 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.
[in] | mB | rmatrix . |
[out] | dErr | Norm of computation error. |
|
inline |
Linear solver (transposed)
Creates rmatrix object as solution of matrix linear equation (which is equivalent to ) where calling matrix is square matrix and parameter mB
is matrix . 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 objects or when matrix is close to singular.
[in] | mB | rmatrix . |
[out] | dErr | Norm of computation error. |
|
inline |
Linear solver.
Creates rmatrix object as solution of matrix linear equation where calling square matrix is matrix and parameter mB
is matrix . Function throws cvmexception in case of inappropriate sizes of the operands or when the matrix is close to singular.
[in] | mB | rmatrix . |
|
inline |
Linear solver (transposed)
Creates rmatrix object as solution of matrix linear equation (which is equivalent to ) where calling matrix is square matrix and parameter mB
is matrix . Function throws cvmexception in case of inappropriate sizes of the objects or when matrix is close to singular.
[in] | mB | rmatrix . |
|
inline |
Linear solver operator (transposed)
Creates rvector object as solution of linear equation (which is equivalent to ) where calling matrix is square matrix and parameter vB
is vector . Operator throws cvmexception in case of inappropriate sizes of the operands or when matrix is close to singular.
[in] | vB | rvector . |
|
inline |
Linear solver operator.
Creates rvector object as solution of linear equation where calling matrix is square matrix and parameter vB
is vector . Operator throws cvmexception in case of inappropriate sizes of the operands or when matrix is close to singular.
[in] | vB | rvector . |
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
|
inline |
LU factorization based linear solver.
Creates object of type rvector as solution of linear equation where calling matrix is square matrix , parameter mLU
is LU factorization (see low_up() ) of matrix , parameter pPivots
is an array of pivot numbers created while factorizing matrix and parameter vB
is vector . Function 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 vectors . In such case you save on matrix factorization since it's needed to be performed just one time. It also sets output parameter dErr
to be equal to the norm of computation error and throws cvmexception in case of inappropriate sizes of the objects or when matrix is close to singular.
[in] | mLU | LU factorization of matrix . |
[in] | pPivots | pivots vector. |
[in] | vB | rvector . |
[out] | dErr | Norm of computation error. |
Definition at line 16899 of file cvm.h.
|
inline |
LU factorization based linear solver.
Creates object of type rvector as solution of linear equation where calling matrix is square matrix , parameter mLU
is LU factorization (see low_up() ) of matrix , parameter pPivots
is an array of pivot numbers created while factorizing matrix and parameter vB
is vector . Function 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 vectors . In such case you save on matrix factorization since it's needed to be performed just one time. It throws cvmexception in case of inappropriate sizes of the objects or when matrix is close to singular.
[in] | mLU | LU factorization of matrix . |
[in] | pPivots | pivots vector. |
[in] | vB | rvector . |
|
inline |
LU factorization based linear solver.
Creates object of type rmatrix as solution of matrix linear equation where calling matrix is square matrix , parameter mLU
is LU factorization (see low_up() ) of matrix , parameter pPivots
is an array of pivot numbers created while factorizing matrix and parameter mB
is matrix . 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. Function also sets output parameter dErr
to be equal to the norm of computation error and throws cvmexception in case of inappropriate sizes of the objects or when matrix is close to singular.
[in] | mLU | LU factorization of matrix . |
[in] | pPivots | pivots vector. |
[in] | mB | rmatrix . |
[out] | dErr | Norm of computation error. |
Definition at line 17079 of file cvm.h.
|
inline |
LU factorization based linear solver.
Creates object of type rmatrix as solution of matrix linear equation where calling matrix is square matrix , parameter mLU
is LU factorization (see low_up() ) of matrix , parameter pPivots
is an array of pivot numbers created while factorizing matrix and parameter mB
is matrix . 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. Function throws cvmexception in case of inappropriate sizes of the objects or when matrix is close to singular.
[in] | mLU | LU factorization of matrix . |
[in] | pPivots | pivots vector. |
[in] | mB | rmatrix . |
|
inline |
Matrix determinant.
Returns determinant of calling matrix. It uses the LU factorization internally and may throw the same exceptions as the factorizer.
|
inline |
Low-up (LU) factorization.
Compute LU factorization of square matrix as
where is permutation matrix, is lower triangular matrix with unit diagonal elements and is upper triangular matrix. Function stores result as the matrix without main diagonal combined with . Function returns pivot indices as array of integers (it should support at least msize() elements) pointed to by nPivots
so -th row was interchanged with nPivots
[ ]-th row. This version sets calling matrix to be equal to matrix m's
LU factorization. Function throws cvmexception in case of inappropriate sizes of the operands or when the matrix to be factorized is close to singular. It is recommended to use iarray for pivot values.
[in] | m | srmatrix to compute LU factorization for. |
[out] | nPivots | Array of pivot indices. |
Definition at line 17284 of file cvm.h.
|
inline |
Low-up (LU) factorization.
Compute LU factorization of square matrix as
where is permutation matrix, is lower triangular matrix with unit diagonal elements and is upper triangular matrix. Function stores result as the matrix without main diagonal combined with . Function returns pivot indices as array of integers (it should support at least msize() elements) pointed to by nPivots
so -th row was interchanged with nPivots
[ ]-th row. This version creates object of type srmatrix as calling matrix LU factorization. Function throws cvmexception in case of inappropriate sizes of the operands or when the matrix to be factorized is close to singular. It is recommended to use iarray for pivot values.
[out] | nPivots | Array of pivot indices. |
Reimplemented in basic_srbmatrix< TR >.
|
inline |
Condition number reciprocal.
Returns condition number reciprocal of calling matrix in the infinity-norm
Less value returned means that matrix is closer to singular. Zero value returned means estimation underflow or that matrix is singular. The condition number is used for error analysis of systems of linear equations. Function throws cvmexception in case of LAPACK subroutines failure.
|
inline |
Matrix inversion.
This version sets calling matrix to be equal to square matrix m
inverted. Function throws cvmexception in case of inappropriate sizes of the operands or when the matrix to be inverted is close to singular.
[in] | m | srmatrix to invert. |
|
inline |
Matrix inversion.
This version creates srmatrix object equal to calling matrix inverted. Function throws cvmexception in case of memory allocation failure or when the matrix to be inverted is close to singular.
Reimplemented in basic_srsmatrix< TR >.
Definition at line 17503 of file cvm.h.
|
inline |
Matrix exponent.
Computes exponent of square matrix using Pade approximation defined as
where
along with the matrix normalizing as described in Gene H. Golub, Charles F. Van Loan. Matrix Computations, The Johns Hopkins University Press, 1996, 694~p., ISBN 0-8018-5413-X, p. 572. Function uses DMEXP (or SMEXP for float
version) FORTRAN
subroutine implementing the algorithm. This version sets calling matrix to be equal to exponent of m
and returns reference to the matrix changed. The algorithm uses parameter tol
as in order to choose constants and so that
This parameter is equal to the largest relative spacing (see cvmMachSp() ) by default. Function throws cvmexception in case of inappropriate sizes of the operands or when LAPACK subroutine fails.
[in] | m | srmatrix to compute exponent for. |
[in] | tol | Computation tolerance. |
|
inline |
Matrix exponent.
Computes exponent of square matrix using Pade approximation defined as
where
along with the matrix normalizing as described in Gene H. Golub, Charles F. Van Loan. Matrix Computations, The Johns Hopkins University Press, 1996, 694~p., ISBN 0-8018-5413-X, p. 572. Function uses DMEXP (or SMEXP for float
version) FORTRAN
subroutine implementing the algorithm. This version creates object of type srmatrix
as exponent of calling matrix. The algorithm uses parameter tol
as in order to choose constants and so that
This parameter is equal to the largest relative spacing (see cvmMachSp() ) by default. Function throws cvmexception in case of inappropriate sizes of the operands or when LAPACK subroutine fails.
[in] | tol | Computation tolerance. |
Reimplemented in basic_srsmatrix< TR >.
Definition at line 17635 of file cvm.h.
|
inline |
Matrix polynomial.
Computes matrix polynomial defined as
using the Horner's rule:
where
See also Gene H. Golub, Charles F. Van Loan. Matrix Computations, The Johns Hopkins University Press, 1996, 694~p., ISBN 0-8018-5413-X, p. 568. The coefficients are passed in parameter v
, where is equal to v.size()-1
, so the function computes matrix polynomial equal to
This version sets calling matrix to be equal to the polynomial of m
. Function uses DPOLY (or SPOLY for float
version) FORTRAN
subroutine implementing the Horner's algorithm. Function throws cvmexception in case of inappropriate sizes of the operands.
[in] | m | srmatrix to compute polynomial for. |
[in] | v | Vector of coefficients. |
Definition at line 17706 of file cvm.h.
|
inline |
Matrix polynomial.
Computes matrix polynomial defined as
using the Horner's rule:
where
See also Gene H. Golub, Charles F. Van Loan. Matrix Computations, The Johns Hopkins University Press, 1996, 694~p., ISBN 0-8018-5413-X, p. 568. The coefficients are passed in parameter v
, where is equal to v.size()-1
, so the function computes matrix polynomial equal to
This version creates object of type srmatrix as the polynomial of calling matrix. Function uses DPOLY (or SPOLY for float
version) FORTRAN
subroutine implementing the Horner's algorithm. Function throws cvmexception in case of memory allocation failure.
[in] | v | Vector of coefficients. |
Reimplemented in basic_srsmatrix< TR >.
Definition at line 17778 of file cvm.h.
|
inline |
Eigenvalues and eigenvectors.
Solves eigenvalue problem and creates cvector object equal to eigenvalues of calling matrix. The eigenvalue problem is defined as follows: given square matrix , find the eigenvalues and the corresponding eigenvectors that satisfy the equation
Some eigenvalues may be complex even for real matrix . Moreover, if real nonsymmetric matrix has a complex eigenvalue corresponding to an eigenvector , then is also an eigenvalue. The eigenvalue corresponds to the eigenvector whose elements are complex conjugate to the elements of . Function sets output parameter mEigVect
to be equal to square matrix containing eigenvectors as columns. Function also computes "left" eigenvectors if parameter bRightVect
is set to false
. Left eigencectors satisfy
Function throws cvmexception in case of inappropriate calling object sizes or in case of convergence error.
[out] | mEigVect | Eigenvectors of calling matrix. |
[in] | bRightVect | true (default) to compute right eigenvectors. |
Definition at line 17853 of file cvm.h.
|
inline |
Eigenvalues.
Solves eigenvalue problem and creates cvector object equal to eigenvalues of calling matrix. The eigenvalue problem is defined as follows: given square matrix , find the eigenvalues and the corresponding eigenvectors that satisfy the equation
Some eigenvalues may be complex even for real matrix . Moreover, if real nonsymmetric matrix has a complex eigenvalue corresponding to an eigenvector , then is also an eigenvalue. The eigenvalue corresponds to the eigenvector whose elements are complex conjugate to the elements of . Function throws cvmexception in case of in caso of memory allocation failure or convergence error.
Reimplemented in basic_srsmatrix< TR >.
Definition at line 17899 of file cvm.h.
|
inline |
Cholesky factorization.
Forms the Cholesky factorization of symmetric positive-definite matrix defined as
where is upper triangular matrix. It utilizes one of ZPOTRF
routines of the LAPACK
library. Function sets calling matrix to be equal to the factorization of symmetric positive-definite matrix m
. Function throws cvmexception in case of inappropriate sizes of the operands or in case of convergence error.
[in] | m | srsmatrix to factorize. |
|
inline |
Bunch-Kaufman factorization.
Forms the Bunch-Kaufman factorization of symmetric matrix (cited from the MKL library documentation):
where is the input matrix passed in parameter m
, is a permutation matrix, and are upper and lower triangular matrices with unit diagonal, and is a symmetric block-diagonal matrix with 1-by-1 and 2-by-2 diagonal blocks. and have 2-by-2 unit diagonal blocks corresponding to the 2-by-2 blocks of . It utilizes one of DSYTRF
routines of the LAPACK
library. Function sets calling matrix to be equal to the factorization of symmetric positive-definite matrix m
. Function throws cvmexception in case of inappropriate sizes of the operands or in case of convergence error. Function is mostly designed to be used for subsequent calls of DSYTRS
, DSYCON
and DSYTRI
routines of the LAPACK
library. Currently it's used internally in det() flow when argument is symmetric but not positive-definite.
[in] | m | srsmatrix to factorize. |
[out] | nPivots | Pivot indices array. |
|
inline |
QR factorization.
Computes QR factorization as
where is calling square matrix, orthogonal matrix and upper triangular matrix are mQ
and mR
respectively. Function throws cvmexception in case if inappropriate sizes of the operands passed.
|
inline |
LQ factorization.
Computes LQ factorization as
where is calling square matrix, lower triangular matrix and orthogonal matrix are mL
and mQ
respectively. Function throws cvmexception in case if inappropriate sizes of the operands passed.
|
inline |
QL factorization.
Computes QL factorization as
where is calling square matrix, orthogonal matrix and lower triangular matrix are mQ
and mL
respectively. Function throws cvmexception in case if inappropriate sizes of the operands passed.
|
inline |
RQ factorization.
Computes RQ factorization as
where is calling square matrix, upper triangular matrix and orthogonal matrix are mR
and mQ
respectively. Function throws cvmexception in case if inappropriate sizes of the operands passed.
|
inline |
Identity matrix.
Sets calling matrix to be equal to identity matrix and returns reference to the matrix changed.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
|
inline |
Set matrix to zero.
Sets every element of calling square 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 from basic_rmatrix< TR >.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.
|
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 from basic_rmatrix< TR >.
Reimplemented in basic_srsmatrix< TR >, and basic_srbmatrix< TR >.