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 vector of complex numbers. More...
#include <cvm.h>
Public Member Functions | |
basic_cvector () | |
Default constructor. | |
basic_cvector (tint nSize) | |
Constructor. | |
basic_cvector (std::initializer_list< TC > list) | |
Constructor. | |
basic_cvector (tint nSize, TC c) | |
Constructor. | |
basic_cvector (TC *pd, tint nSize, tint nIncr=1) | |
Constructor. | |
basic_cvector (const TC *pd, tint nSize, tint nIncr=1) | |
Constructor. | |
basic_cvector (const basic_cvector &v) | |
Copy constructor. | |
basic_cvector (basic_cvector &&a) noexcept | |
Move constructor. | |
basic_cvector (const TR *pRe, const TR *pIm, tint nSize, tint nIncrRe=1, tint nIncrIm=1) | |
Constructor. | |
basic_cvector (const basic_rvector< TR > &vRe, const basic_rvector< TR > &vIm) | |
Constructor. | |
basic_cvector (const TR *pA, tint nSize, bool bRealPart=true, tint nIncr=1) | |
Constructor. | |
basic_cvector (const basic_rvector< TR > &v, bool bRealPart=true) | |
Constructor. | |
basic_rvector< TR > | real () |
Real part (l-value) | |
basic_rvector< TR > | imag () |
Imaginary part (l-value) | |
basic_cvector & | operator= (const basic_cvector &v) throw (cvmexception) |
Assignment operator. | |
basic_cvector & | operator= (basic_cvector &&a) throw (cvmexception) |
Move assignment operator. | |
basic_cvector & | assign (const TC *pd, tint nIncr=1) |
External array assignment. | |
basic_cvector & | assign (tint n, const TC *pd, tint nIncr=1) |
External array assignment (to tail) | |
basic_cvector & | assign (tint n, const TC *pd, tint nSize, tint nIncr) |
External array assignment (range) | |
basic_cvector & | assign (tint n, const basic_cvector &v) throw (cvmexception) |
Subvector assignment. | |
basic_cvector & | set (TC c) |
Sets all elements to one value. | |
basic_cvector & | assign_real (const basic_rvector< TR > &vRe) throw (cvmexception) |
Assignment to real part. | |
basic_cvector & | assign_imag (const basic_rvector< TR > &vIm) throw (cvmexception) |
Assignment to imaginary part. | |
basic_cvector & | set_real (TR d) |
Fills real part. | |
basic_cvector & | set_imag (TR d) |
Fills imaginary part. | |
basic_cvector & | resize (tint nNewSize) throw (cvmexception) |
Changes size of vector. | |
bool | operator== (const basic_cvector &v) const |
Vector comparison. | |
bool | operator!= (const basic_cvector &v) const |
Vector comparison. | |
basic_cvector & | operator<< (const basic_cvector &v) throw (cvmexception) |
Vector replacement. | |
basic_cvector | operator+ (const basic_cvector &v) const throw (cvmexception) |
Addition operator. | |
basic_cvector | operator- (const basic_cvector &v) const throw (cvmexception) |
Subtraction operator. | |
basic_cvector & | sum (const basic_cvector &v1, const basic_cvector &v2) throw (cvmexception) |
Sum of vectors. | |
basic_cvector & | diff (const basic_cvector &v1, const basic_cvector &v2) throw (cvmexception) |
Difference of vectors. | |
basic_cvector & | operator+= (const basic_cvector &v) throw (cvmexception) |
Increment operator. | |
basic_cvector & | operator-= (const basic_cvector &v) throw (cvmexception) |
Decrement operator. | |
basic_cvector | operator- () const throw (cvmexception) |
Unary minus operator. | |
basic_cvector | operator* (TR dMult) const |
Multiply by real number operator. | |
basic_cvector | operator/ (TR dDiv) const throw (cvmexception) |
Divide by real number operator. | |
basic_cvector | operator* (TC cMult) const |
Multiply by complex number operator. | |
basic_cvector | operator/ (TC cDiv) const throw (cvmexception) |
Divide by complex number operator. | |
basic_cvector & | operator*= (TR dMult) |
Multiply by real number and assign. | |
basic_cvector & | operator/= (TR dDiv) |
Divide by real number and assign. | |
basic_cvector & | operator*= (TC cMult) |
Multiply by complex number and assign. | |
basic_cvector & | operator/= (TC cDiv) |
Divide by complex number and assign. | |
basic_cvector & | normalize () |
Vector normalizer. | |
basic_cvector | operator~ () const throw (cvmexception) |
Conjugation operator. | |
basic_cvector & | conj (const basic_cvector &v) throw (cvmexception) |
Conjugation. | |
basic_cvector & | conj () |
Conjugation. | |
TC | operator* (const basic_cvector &v) const throw (cvmexception) |
Scalar product. | |
TC | operator% (const basic_cvector &v) const throw (cvmexception) |
Scalar product. | |
basic_cvector | operator* (const basic_cmatrix< TR, TC > &m) const throw (cvmexception) |
Vector-matrix product. | |
basic_cvector & | mult (const basic_cvector &v, const basic_cmatrix< TR, TC > &m) throw (cvmexception) |
Vector-matrix product. | |
basic_cvector & | mult (const basic_cmatrix< TR, TC > &m, const basic_cvector &v) throw (cvmexception) |
Matrix-vector product. | |
basic_cmatrix< TR, TC > | rank1update_u (const basic_cvector &v) const |
Rank-1 update (unconjugated) | |
basic_cmatrix< TR, TC > | rank1update_c (const basic_cvector &v) const |
Rank-1 update (conjugated) | |
basic_cvector & | solve (const basic_scmatrix< TR, TC > &mA, const basic_cvector &vB, TR &dErr) throw (cvmexception) |
Linear solver. | |
basic_cvector & | solve_tran (const basic_scmatrix< TR, TC > &mA, const basic_cvector &vB, TR &dErr) throw (cvmexception) |
Linear solver (transposed) | |
basic_cvector & | solve_conj (const basic_scmatrix< TR, TC > &mA, const basic_cvector &vB, TR &dErr) throw (cvmexception) |
Linear solver (conjugated) | |
basic_cvector & | solve (const basic_scmatrix< TR, TC > &mA, const basic_cvector &vB) throw (cvmexception) |
Linear solver. | |
basic_cvector & | solve_tran (const basic_scmatrix< TR, TC > &mA, const basic_cvector &vB) throw (cvmexception) |
Linear solver (transposed) | |
basic_cvector & | solve_conj (const basic_scmatrix< TR, TC > &mA, const basic_cvector &vB) throw (cvmexception) |
Linear solver (conjugated) | |
basic_cvector | operator/ (const basic_scmatrix< TR, TC > &mA) const throw (cvmexception) |
Linear solver operator (transposed) | |
basic_cvector | operator% (const basic_scmatrix< TR, TC > &mA) const throw (cvmexception) |
Linear solver operator. | |
basic_cvector & | solve_lu (const basic_scmatrix< TR, TC > &mA, const basic_scmatrix< TR, TC > &mLU, const tint *pPivots, const basic_cvector &vB, TR &dErr) throw (cvmexception) |
LU factorization based linear solver. | |
basic_cvector & | solve_lu (const basic_scmatrix< TR, TC > &mA, const basic_scmatrix< TR, TC > &mLU, const tint *pPivots, const basic_cvector &vB) throw (cvmexception) |
LU factorization based linear solver. | |
basic_cvector & | gels (bool conjugate, const basic_cmatrix< TR, TC > &mA, const basic_cvector &vB, TC &cErr) throw (cvmexception) |
Overdetermined or underdetermined linear solver. | |
basic_cvector & | gelsy (const basic_cmatrix< TR, TC > &mA, const basic_cvector &vB, tint &rank, TR tol=basic_cvmMachSp< TR >()) throw (cvmexception) |
Linear least squares problem. | |
basic_cvector & | gelss (const basic_cmatrix< TR, TC > &mA, const basic_cvector &vB, basic_rvector< TR > &sv, tint &rank, TR tol=basic_cvmMachSp< TR >()) throw (cvmexception) |
Linear least squares problem. | |
basic_cvector & | gelsd (const basic_cmatrix< TR, TC > &mA, const basic_cvector &vB, basic_rvector< TR > &sv, tint &rank, TR tol=basic_cvmMachSp< TR >()) throw (cvmexception) |
Linear least squares problem. | |
basic_cvector & | eig (const basic_srmatrix< TR > &mA) throw (cvmexception) |
Eigenvalues. | |
basic_cvector & | eig (const basic_srmatrix< TR > &mA, basic_scmatrix< TR, TC > &mEigVect, bool bRightVect=true) throw (cvmexception) |
Eigenvalues anf eigenvectors. | |
basic_cvector & | eig (const basic_scmatrix< TR, TC > &mA) throw (cvmexception) |
Eigenvalues. | |
basic_cvector & | eig (const basic_scmatrix< TR, TC > &mA, basic_scmatrix< TR, TC > &mEigVect, bool bRightVect=true) throw (cvmexception) |
Eigenvalues. | |
basic_cvector & | geneig (const basic_srmatrix< TR > &mA, const basic_srmatrix< TR > &mB, basic_rvector< TR > &vBeta) throw (cvmexception) |
Generalized eigenvalues of real matrices. | |
basic_cvector & | geneig (const basic_srmatrix< TR > &mA, const basic_srmatrix< TR > &mB, basic_rvector< TR > &vBeta, basic_scmatrix< TR, TC > &mEigVectLeft, basic_scmatrix< TR, TC > &mEigVectRight) throw (cvmexception) |
Generalized eigenvalues of real matrices. | |
basic_cvector & | geneig (const basic_srmatrix< TR > &mA, const basic_srmatrix< TR > &mB, basic_rvector< TR > &vBeta, basic_scmatrix< TR, TC > &mEigVect, bool bRightVect=true) throw (cvmexception) |
Generalized eigenvalues of real matrices. | |
basic_cvector & | geneig (const basic_scmatrix< TR, TC > &mA, const basic_scmatrix< TR, TC > &mB, basic_cvector &vBeta) throw (cvmexception) |
Generalized eigenvalues of complex matrices. | |
basic_cvector & | geneig (const basic_scmatrix< TR, TC > &mA, const basic_scmatrix< TR, TC > &mB, basic_cvector &vBeta, basic_scmatrix< TR, TC > &mEigVectLeft, basic_scmatrix< TR, TC > &mEigVectRight) throw (cvmexception) |
Generalized eigenvalues of complex matrices. | |
basic_cvector & | geneig (const basic_scmatrix< TR, TC > &mA, const basic_scmatrix< TR, TC > &mB, basic_cvector &vBeta, basic_scmatrix< TR, TC > &mEigVect, bool bRightVect=true) throw (cvmexception) |
Generalized eigenvalues of complex matrices. | |
basic_cvector & | gemv (bool bLeft, const basic_cmatrix< TR, TC > &m, TC dAlpha, const basic_cvector &v, TC dBeta) throw (cvmexception) |
Generic matrix-vector operation. | |
basic_cvector & | gbmv (bool bLeft, const basic_scbmatrix< TR, TC > &m, TC dAlpha, const basic_cvector &v, TC dBeta) throw (cvmexception) |
Generic band matrix-vector operation. | |
basic_cvector & | randomize_real (TR dFrom, TR dTo) |
Randomizer (real part) | |
basic_cvector & | randomize_imag (TR dFrom, TR dTo) |
Randomizer (imaginary part) | |
Public Member Functions inherited from basic_array< TR, TC > | |
basic_array () | |
Default constructor. | |
basic_array (tint nSize, bool bZeroMemory=true) | |
Constructor. | |
basic_array (TC *pd, tint nSize, tint nIncr=1) | |
Constructor. | |
basic_array (const TC *pd, tint nSize, tint nIncr=1) | |
Constructor. | |
basic_array (const TC *begin, const TC *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. | |
TC * | get () |
Pointer to data. | |
const TC * | get () const |
Const pointer to data. | |
operator TC * () | |
Type cast to pointer to data. | |
operator const TC * () const | |
Type cast to constant pointer to data. | |
TC & | operator() (tint n) throw (cvmexception) |
Reference to element (l-value) | |
TC | operator() (tint n) const throw (cvmexception) |
Value of element (not l-value) | |
TC & | operator[] (tint n) throw (cvmexception) |
Reference to element (l-value) | |
TC | operator[] (tint n) const throw (cvmexception) |
Value of element (not l-value) | |
basic_array & | assign (const TC *p) |
Assignment from external 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. | |
virtual TR | norminf () const |
Infinity norm. | |
virtual TR | norm1 () const |
1-norm | |
virtual TR | norm2 () const |
2-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 | assign (size_type n, const TC &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 | |
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 TC &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 TC &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, TC > | |
typedef TC | 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 Attributes inherited from basic_array< TR, TC > | |
tint | msz |
Number of elements of type TC allocated. | |
tint | mincr |
Increment (distance) between elements (default is 1, i.e. elements follow each other) | |
std::shared_ptr< TC > | mp |
native data pointer | |
TC * | mpf |
Foreign data pointer. |
End-user class encapsulating vector of complex numbers.
TR
type stands for treal, TC
type stands for tcomplex. Please use predefined cvector class in your applications.
|
inline |
Default constructor.
Creates zero size cvector. No memory gets allocated.
Definition at line 6184 of file cvm.h.
|
inlineexplicit |
Constructor.
Creates cvector object of given size. It throws cvmexception in case of non-positive size passed or memory allocation failure.
[in] | nSize | Size of cvector (must be positive). |
|
inline |
Constructor.
Creates cvector object and fills it with values provided in the initializer list. This constructor is available only if your compiler supports initializer lists (GCC 4.4 and higher, MS Visual Studio 2013 and higher, Apple LLVM 5.0 and higher).
[in] | list | Initializer list as shown above. |
|
inline |
Constructor.
Creates cvector object of given size and fills it with given complex number. It throws cvmexception in case of non-positive size passed or memory allocation failure.
|
inline |
Constructor.
Creates cvector object of given size with given increment between elements (default is 1). 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
using distance between elements equal to nIncr
. It is intented to make possible the following syntax:
And for example this code...
will also call this constructor and memory will be shared.
If you need the code like this with memory allocation, use the following:
[in] | pd | Pointer to array to share memory with. |
[in] | nSize | Size of cvector (must be positive). |
[in] | nIncr | Increment between elements, default is 1 (one after another). |
|
inline |
Constructor.
Creates cvector of nSize
elements with increment 1 in between. This is const version, it allocates memory and copies every nIncr-th
element (deep copy) from external array pointed to by pd
parameter. It copies nSize
elements total.
[in] | pd | Const pointer to external array. |
[in] | nSize | Number of array elements. |
[in] | nIncr | Increment between external array elements. |
|
inline |
Copy constructor.
Creates cvector object of size equal to size of vector v
and sets every element of created vector to be equal to appropriate element of v
. Constructor throws cvmexception in case of memory allocation failure.
[in] | v | Vector to copy from. |
Definition at line 6421 of file cvm.h.
|
inline |
Move constructor.
Implements move semantics introduced in new C++ standard. Moves data ownership from other vector 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] | a | rvalue reference to other array. |
|
inline |
Constructor.
Creates cvector of nSize
elements with increment 1 in between. Constructor copies every nIncrRe-th
element of array pointed to by pRe
and every nIncrIm-th
element of array pointed to by pIm
to real and imaginary part of the object created. It throws cvmexception in case of non-positive size passed or memory allocation failure.
[in] | pRe | Const pointer to external real array. |
[in] | pIm | Const pointer to external imaginary array. |
[in] | nSize | Number of array elements. |
[in] | nIncrRe | Increment between external real array elements. |
[in] | nIncrIm | Increment between external iumaginary array elements. |
Definition at line 6488 of file cvm.h.
|
inline |
Constructor.
Creates cvector object of size equal to vRe.size()
and vIm.size()
and copies vectors vRe
and vIm
to real and imaginary part of the object created. It throws cvmexception in case of non-equal sizes of the parameters passed or memory allocation failure.
Definition at line 6527 of file cvm.h.
|
inline |
Constructor.
Creates cvector object of size equal to nSize
and copies every nIncr-th
element of array pointed to by pA
to real (if bRealPart
is true
) or imaginary (if bRealPart
is false
) part of the object created. Constructor throws cvmexception in case of non-positive size passed or memory allocation failure.
[in] | pA | basic_array of real values. |
[in] | nSize | Size of cvector (must be positive). |
[in] | bRealPart | True to copy pA values to real part of the object created. |
[in] | nIncr | Copy every nIncr-th element of pA array. |
Definition at line 6566 of file cvm.h.
|
inlineexplicit |
Constructor.
Creates cvector object of size equal to v.size()
and copies every element of vector v
to real (if bRealPart
is true
) or imaginary (if bRealPart
is false
) part of the object created. Constructor throws cvmexception in case of memory allocation failure.
[in] | v | rvector to copy values from. |
[in] | bRealPart | True to copy v values to real part of the object created. |
Definition at line 6603 of file cvm.h.
|
inline |
Real part (l-value)
Creates rvector object of size equal to size of calling vector sharing memory with its real part. In other words, the vector returned is l-value.
Definition at line 6637 of file cvm.h.
|
inline |
Imaginary part (l-value)
Creates rvector object of size equal to size of calling vector sharing memory with its imaginary part. In other words, the vector returned is l-value.
Definition at line 6668 of file cvm.h.
|
inline |
Assignment operator.
Sets every element of calling cvector to be equal to appropriate element of vector v
and returns reference to the vector changed. Operator throws cvmexception in case of different vector sizes.
[in] | v | cvector to assign from. |
Definition at line 6700 of file cvm.h.
|
inline |
Move assignment operator.
Implements move semantics introduced in new C++ standard. Moves data ownership from other vector 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] | a | rvalue reference to other array. |
Definition at line 6720 of file cvm.h.
|
inline |
External array assignment.
Sets every element of calling vector to be equal to every nIncr-th
element of array pointed to by parameter pd
and returns reference to the vector changed.
[in] | pd | Const pointer to external array. |
[in] | nIncr | Increment between elements in external array. |
Definition at line 6757 of file cvm.h.
|
inline |
External array assignment (to tail)
Sets every element of calling vector, starting from CVM0 based n-th
one till the end, to be equal to every nIncr-th
element of array pointed to by parameter pd
and returns reference to the vector changed.
[in] | n | Start cvector index to assign from. |
[in] | pd | Const pointer to external array. |
[in] | nIncr | Increment between elements in external array. |
Definition at line 6792 of file cvm.h.
|
inline |
External array assignment (range)
Sets every element of calling vector, starting from CVM0 based n-th
one, up to nSize
total, to be equal to every nIncr-th
element of array pointed to by parameter pd
and returns reference to the vector changed. If n+nSize
goes beyond rvector boundaries assignment stops at the last element.
[in] | n | Start cvector index to assign from. |
[in] | pd | Const pointer to external array. |
[in] | nSize | Maximum number of elements to be assigned. |
[in] | nIncr | Increment between elements in external array. |
Definition at line 6827 of file cvm.h.
|
inline |
Subvector assignment.
Sets every element of calling vector's sub-vector beginning with CVM0 based index n
to vector v
and returns reference to the vector changed. Function throws cvmexception if n
is not positive or v.size()+n-1
is greater than calling vector's size.
[in] | n | Start cvector index to assign from. |
[in] | v | Const reference to vector. |
Definition at line 6862 of file cvm.h.
|
inline |
Sets all elements to one value.
Sets every element of calling vector to be equal to parameter c
and returns reference to the vector changed.
[in] | c | Value to set to. |
Reimplemented from basic_array< TR, TC >.
|
inline |
Assignment to real part.
Sets real part of every element of calling vector to be equal to appropriate element of vector vRe
and returns reference to the vector changed. Function throws cvmexception in case of different sizes of the operands.
[in] | vRe | rvector to assign to real part. |
Definition at line 6923 of file cvm.h.
|
inline |
Assignment to imaginary part.
Sets imaginary part of every element of calling vector to be equal to appropriate element of vector vIm
and returns reference to the vector changed. Function throws cvmexception in case of different sizes of the operands.
[in] | vIm | rvector to assign to imaginary part. |
Definition at line 6956 of file cvm.h.
|
inline |
Fills real part.
Sets real part of every element of calling vector to be equal to parameter x
and returns reference to the vector changed.
[in] | d | treal number to fill real part with. |
|
inline |
Fills imaginary part.
Sets imaginary part of every element of calling vector to be equal to parameter x
and returns reference to the vector changed.
[in] | d | treal number to fill imaginary part with. |
|
inline |
Changes size of vector.
Changes size of calling vector to be equal to nNewSize
and returns reference to the vector changed. In case of increasing of its size, the vector is filled up with zeroes. Function throws cvmexception in case of negative size passed or memory allocation failure.
[in] | nNewSize | New size. |
Reimplemented from basic_array< TR, TC >.
|
inline |
Vector comparison.
Operator compares calling vector with vector v
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] | v | cvector to compare to. |
Definition at line 7089 of file cvm.h.
|
inline |
Vector comparison.
Operator compares calling vector with vector v
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] | v | cvector to compare to. |
Definition at line 7119 of file cvm.h.
|
inline |
Vector replacement.
Destroys calling vector, creates a new one as a copy of v
and returns reference to the vector changed. Operator throws cvmexception in case of memory allocation failure.
[in] | v | cvector to replace by. |
Definition at line 7160 of file cvm.h.
|
inline |
Addition operator.
Creates object of type cvector as sum of calling vector and vector v
. Operator throws cvmexception in case of different sizes of the operands or memory allocation failure.
[in] | v | cvector to add to calling one. |
Definition at line 7203 of file cvm.h.
|
inline |
Subtraction operator.
Creates object of type cvector as difference of calling vector and vector v
. It throws cvmexception in case of different sizes of the operands or memory allocation failure.
[in] | v | cvector to subtract from calling one. |
Definition at line 7246 of file cvm.h.
|
inline |
Sum of vectors.
Assigns sum of vectors v1
and v2
to calling vector and returns reference to the vector changed. It throws cvmexception in case of different sizes of the operands.
Definition at line 7291 of file cvm.h.
|
inline |
Difference of vectors.
Assigns difference of vectors v1
and v2
to calling vector and returns reference to the vector changed. It throws cvmexception in case of different sizes of the operands.
Definition at line 7336 of file cvm.h.
|
inline |
Increment operator.
Adds vector v
to calling vector and returns reference to the vector changed. It throws cvmexception in case of different sizes of the operands.
[in] | v | cvector to increment by. |
Definition at line 7383 of file cvm.h.
|
inline |
Decrement operator.
Subtracts vector v
from calling vector and returns reference to the vector changed. It throws cvmexception in case of different sizes of the operands.
[in] | v | cvector to decrement by. |
Definition at line 7429 of file cvm.h.
|
inline |
Unary minus operator.
Creates object of type cvector as calling vector multiplied by -1
. It throws cvmexception in case of memory allocation failure.
|
inline |
Multiply by real number operator.
Creates object of type cvector as product of calling vector and treal number dMult
. It throws cvmexception in case of memory allocation failure.
[in] | dMult | Number to multiply by. |
|
inline |
Divide by real number operator.
Creates object of type cvector as quotient of calling vector and treal 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. |
|
inline |
Multiply by complex number operator.
Creates object of type cvector as product of calling vector and tcomplex number cMult
. It throws cvmexception in case of memory allocation failure.
[in] | cMult | Number to multiply by. |
|
inline |
Divide by complex number operator.
Creates object of type cvector as quotient of calling vector and tcomplex number cDiv
. It throws cvmexception if cDiv
has absolute value equal or less than cvmMachMin() (the smallest normalized positive number). It also throws exception in case of memory allocation failure.
[in] | cDiv | Number to divide by. |
|
inline |
Multiply by real number and assign.
Multiplies calling vector by treal number dMult
and returns reference to the vector changed.
[in] | dMult | Number to multiply by. |
|
inline |
Divide by real number and assign.
Divides calling vector by treal number dDiv
and returns reference to the vector 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. |
|
inline |
Multiply by complex number and assign.
Multiplies calling vector by tcomplex number cMult
and returns reference to the vector changed.
[in] | cMult | Number to multiply by. |
|
inline |
Divide by complex number and assign.
Divides calling vector by tcomplex number cDiv
and returns reference to the vector changed. It throws cvmexception if cDiv
has absolute value equal or less than cvmMachMin() (the smallest normalized positive number).
[in] | cDiv | Number to divide by. |
|
inline |
Vector normalizer.
Normalizes calling vector 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.
|
inline |
Conjugation operator.
Creates object of type cvector as complex conjugated calling vector It throws cvmexception in case of memory allocation failure.
Definition at line 7789 of file cvm.h.
|
inline |
Conjugation.
Sets calling vector to be equal to vector v
conjugated It throws cvmexception in case of different sizes of the operands)
Definition at line 7824 of file cvm.h.
|
inline |
Conjugation.
Sets calling vector to be equal to conjugated itself.
Definition at line 7859 of file cvm.h.
|
inline |
Scalar product.
Scalar product of calling vector and vector v
. It throws cvmexception if the operands have different sizes.
[in] | v | cvector to compute scalar product with. |
Definition at line 7890 of file cvm.h.
|
inline |
Scalar product.
Scalar product of complex conjugated calling vector and vector v
. It throws cvmexception if the operands have different sizes.
[in] | v | cvector to compute scalar product with. |
Definition at line 7923 of file cvm.h.
|
inline |
Vector-matrix product.
Creates object of type cvector
as product of calling vector and matrix m
. Use mult() function to avoid new object creation. Operator throws cvmexception if calling vector's size differs from number of rows in matrix m
.
[in] | m | cmatrix to multiply calling vector by. |
Definition at line 7963 of file cvm.h.
|
inline |
Vector-matrix product.
Sets calling vector to be equal to product of vector v
by matrix m
and returns reference to the object changed.
Definition at line 8012 of file cvm.h.
|
inline |
Matrix-vector product.
Sets calling vector to be equal to product of matrix m
by vector v
by and returns reference to the object changed.
Definition at line 8060 of file cvm.h.
|
inline |
Rank-1 update (unconjugated)
Creates object of type cmatrix as rank-1 update of calling vector and vector v
. The rank-1 update of vector-column of size and vector-row of size is defined as matrix
[in] | v | cvector to compute rank-1 update with. |
Definition at line 8111 of file cvm.h.
|
inline |
Rank-1 update (conjugated)
Creates object of type cmatrix as rank-1 update of calling vector and complex conjugated vector v
. The rank-1 update of vector-column of size and vector-row of size is defined as matrix
where is -th complex conjugated element of .
[in] | v | cvector to compute rank-1 update with. |
Definition at line 8168 of file cvm.h.
|
inline |
Linear solver.
Sets calling vector to be equal to solution of linear equation where parameter mA
is square matrix and parameter vB
is vector . Function returns reference to the vector 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 objects or when matrix is close to singular.
Definition at line 8221 of file cvm.h.
|
inline |
Linear solver (transposed)
Sets calling vector to be equal to solution of linear equation (which is equivalent to ) where parameter mA
is square matrix and parameter vB
is vector . Function returns reference to the vector 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 objects or when matrix is close to singular.
Definition at line 8273 of file cvm.h.
|
inline |
Linear solver (conjugated)
Sets calling vector to be equal to solution of linear equation (here is conjugated ) where parameter mA
is square complex matrix and parameter vB
is complex vector . Function returns reference to the vector changed. It also sets output parameter dErr
to be equal to the norm of computation error. Functions throws cvmexception in case of inappropriate sizes of the objects or when the matrix is close to singular.
Definition at line 8323 of file cvm.h.
|
inline |
Linear solver.
Sets calling vector to be equal to solution of linear equation where parameter mA
is square matrix and parameter vB
is vector . Function returns reference to the vector changed. Function throws cvmexception in case of inappropriate sizes of the objects or when matrix is close to singular.
Definition at line 8366 of file cvm.h.
|
inline |
Linear solver (transposed)
Sets calling vector to be equal to solution of linear equation (which is equivalent to ) where parameter mA
is square matrix and parameter vB
is vector . Function returns reference to the vector changed. Function throws cvmexception in case of inappropriate sizes of the objects or when matrix is close to singular.
Definition at line 8415 of file cvm.h.
|
inline |
Linear solver (conjugated)
Sets calling vector to be equal to solution of linear equation (here is conjugated ) where parameter mA
is square complex matrix and parameter vB
is complex vector . Function returns reference to the vector changed. Functions throws cvmexception in case of inappropriate sizes of the objects or when the matrix is close to singular.
Definition at line 8462 of file cvm.h.
|
inline |
Linear solver operator (transposed)
Returns solution of linear equation (which is equivalent to ) where parameter mA
is square matrix and calling vector is . This operator throws cvmexception in case of inappropriate sizes of the objects or when matrix is close to singular.
[in] | mA | scmatrix . |
|
inline |
Linear solver operator.
Returns solution of linear equation where parameter mA
is square matrix and calling vector is . This operator throws cvmexception in case of inappropriate sizes of the objects or when matrix is close to singular.
[in] | mA | scmatrix . |
|
inline |
LU factorization based linear solver.
Sets calling vector to be equal to solution of linear equation where parameter mA
is square matrix , parameter mLU
is LU factorization (see scmatrix::low_up() ) of matrix , parameter pPivots
is an array of pivot numbers created while factorizing matrix and parameter vB
is vector . Function returns reference to the vector 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 vectors . 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 | scmatrix . |
[in] | mLU | LU factorization of matrix . |
[in] | pPivots | pivots vector. |
[in] | vB | rvector . |
[out] | dErr | Norm of computation error. |
Definition at line 8614 of file cvm.h.
|
inline |
LU factorization based linear solver.
Sets calling vector to be equal to solution of linear equation where parameter mA
is square matrix , parameter mLU
is LU factorization (see scmatrix::low_up() ) of matrix , parameter pPivots
is an array of pivot numbers created while factorizing matrix and parameter vB
is vector . Function returns reference to the vector changed. 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. Throws cvmexception in case of inappropriate sizes of the objects or when matrix is close to singular.
[in] | mA | scmatrix . |
[in] | mLU | LU factorization of matrix . |
[in] | pPivots | pivots vector. |
[in] | vB | rvector . |
Definition at line 8679 of file cvm.h.
|
inline |
Overdetermined or underdetermined linear solver.
Solves overdetermined or underdetermined linear system
for matrix (or conjugateed one) where is a vector of length and in non-conjugateed case and otherwise. The algorithm uses QR or LQ factorization of . It is assumed that has full rank, infinity returned otherwise. Internally function uses ZGELS
LAPACK routines. If and conjugate=false
or and conjugate=true
, then the system is overdetermined, thus the algorithm tries to find the least squares solution of the problem
respectively. Complex number cErr
returns residuals. The system is underdetermined otherwise, and the algorithm finds its minimum norm solution. In this case cErr
is set to zero. In both cases the solution computed satisfies , but this algorithm is faster than pseudo inversion. Function sets calling object to be the solution and returns reference to it. It throws cvmexception in case of inappropriate sizes of the operands.
[in] | conjugate | True to compute for conjugated matrix . |
[in] | mA | cmatrix . |
[in] | vB | cvector . |
[out] | cErr | Norm of computation error. |
Definition at line 8750 of file cvm.h.
|
inline |
Linear least squares problem.
Computes minimum-norm solution to linear least squares problem
using complete orthogonal factorization of 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 ZGELSY
LAPACK routines, see more details about the algorithm in those routines' documentation. Matrix is passed as argument mA
. Function sets calling object to be the solution and returns reference to it. It throws cvmexception in case of inappropriate sizes of the operands.
[in] | mA | cmatrix . |
[in] | vB | cvector . |
[out] | rank | Rank of matrix . |
[in] | tol | Rank computation tolerance. |
Definition at line 8813 of file cvm.h.
|
inline |
Linear least squares problem.
Computes minimum-norm solution to linear least squares problem
using singular value decomposition of matrix . Here is a vector of length . Matrix may be rank-deficient, function returns its effective rank in rank
output parameter using tol
tolerance. This function also computes singular values of in decreasing order and returns them in sv
output parameter having size. Internally function uses ZGELSS
LAPACK routines, see more details about the algorithm in that routine's documentation. Matrix is passed as argument mA
. Function sets calling object to be the solution and returns reference to it. It throws cvmexception in case of inappropriate sizes of the operands.
[in] | mA | cmatrix . |
[in] | vB | cvector . |
[out] | sv | Singular values of matrix . |
[out] | rank | Rank of matrix . |
[in] | tol | Rank computation tolerance. |
|
inline |
Linear least squares problem.
Computes minimum-norm solution to linear least squares problem
using singular value decomposition of 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. This function also computes singular values of in decreasing order and returns them in sv
output parameter having size. Internally function uses ZGELSD
LAPACK routines, see more details about the algorithm in that routine's documentation. Matrix is passed as argument mA
. Function sets calling object to be the solution and returns reference to it. It throws cvmexception in case of inappropriate sizes of the operands.
[in] | mA | cmatrix . |
[in] | vB | cvector . |
[out] | sv | Singular values of matrix . |
[out] | rank | Rank of matrix . |
[in] | tol | Rank computation tolerance. |
|
inline |
Eigenvalues.
Solves eigenvalue problem and sets calling vector to be equal to eigenvalues of real square matrix mA
. 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 returns reference to the vector changed and throws cvmexception in case of inappropriate calling object sizes or in case of convergence error.
[in] | mA | srmatrix . |
Definition at line 8994 of file cvm.h.
|
inline |
Eigenvalues anf eigenvectors.
Solves eigenvalue problem and sets calling vector to be equal to eigenvalues of real square matrix mA
. 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 returns reference to the vector changed and throws cvmexception in case of inappropriate calling object sizes or in case of convergence error.
[in] | mA | srmatrix . |
[out] | mEigVect | Eigenvectors of mA . |
[in] | bRightVect | true (default) to compute right eigenvectors. |
Definition at line 9074 of file cvm.h.
|
inline |
Eigenvalues.
Solves eigenvalue problem and sets calling vector to be equal to eigenvalues of complex square matrix mA
. The eigenvalue problem is defined as follows: given square matrix , find the eigenvalues and the corresponding eigenvectors that satisfy the equation
Function returns reference to the vector changed and throws cvmexception in case of inappropriate calling object sizes or in case of convergence error.
[in] | mA | scmatrix . |
Definition at line 9120 of file cvm.h.
|
inline |
Eigenvalues.
Solves eigenvalue problem and sets calling vector to be equal to eigenvalues of complex square matrix mA
. The eigenvalue problem is defined as follows: given square matrix , find the eigenvalues and the corresponding eigenvectors that satisfy the equation
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 returns reference to the vector changed and throws cvmexception in case of inappropriate calling object sizes or in case of convergence error.
[in] | mA | scmatrix . |
[out] | mEigVect | Eigenvectors of mA . |
[in] | bRightVect | true (default) to compute right eigenvectors. |
Definition at line 9192 of file cvm.h.
|
inline |
Generalized eigenvalues of real matrices.
Solves generalized eigenvalue problem and sets calling complex vector to be equal to generalized eigenvalues of real square matrices mA
and mB
. A generalized eigenvalue for a pair of matrices is a scalar or a ratio , such that is singular. It is usually represented as the pair , as there is a reasonable interpretation for and even for both being zero. Function returns reference to the vector changed and throws cvmexception in case of inappropriate calling object sizes or in case of convergence error.
Definition at line 9244 of file cvm.h.
|
inline |
Generalized eigenvalues of real matrices.
Solves generalized eigenvalue problem and sets calling complex vector to be equal to generalized eigenvalues of real square matrices mA
and mB
. A generalized eigenvalue for a pair of matrices is a scalar or a ratio , such that is singular. It is usually represented as the pair , as there is a reasonable interpretation for and even for both being zero. The right generalized eigenvector corresponding to the generalized eigenvalue of satisfies
The left generalized eigenvector corresponding to the generalized eigenvalue of satisfies
Function returns reference to the vector changed and throws cvmexception in case of inappropriate calling object sizes or in case of convergence error.
[in] | mA | srmatrix . |
[in] | mB | srmatrix . |
[out] | vBeta | computed values. |
[out] | mEigVectLeft | computed left eigenvectors stored by columns. |
[out] | mEigVectRight | computed right eigenvectors stored by columns. |
Definition at line 9328 of file cvm.h.
|
inline |
Generalized eigenvalues of real matrices.
Solves generalized eigenvalue problem and sets calling complex vector to be equal to generalized eigenvalues of real square matrices mA
and mB
. A generalized eigenvalue for a pair of matrices is a scalar or a ratio , such that is singular. It is usually represented as the pair , as there is a reasonable interpretation for and even for both being zero. The right generalized eigenvector corresponding to the generalized eigenvalue of satisfies
The left generalized eigenvector corresponding to the generalized eigenvalue of satisfies
Function returns reference to the vector changed and throws cvmexception in case of inappropriate calling object sizes or in case of convergence error.
[in] | mA | srmatrix . |
[in] | mB | srmatrix . |
[out] | vBeta | computed values. |
[out] | mEigVect | computed left or right eigenvectors stored by columns. |
[in] | bRightVect | true to compute right eigenvectors, false to compute left ones. |
Definition at line 9418 of file cvm.h.
|
inline |
Generalized eigenvalues of complex matrices.
Solves generalized eigenvalue problem and sets calling complex vector to be equal to generalized eigenvalues of complex square matrices mA
and mB
. A generalized eigenvalue for a pair of matrices is a scalar or a ratio , such that is singular. It is usually represented as the pair , as there is a reasonable interpretation for and even for both being zero. Function returns reference to the vector changed and throws cvmexception in case of inappropriate calling object sizes or in case of convergence error.
Definition at line 9479 of file cvm.h.
|
inline |
Generalized eigenvalues of complex matrices.
Solves generalized eigenvalue problem and sets calling complex vector to be equal to generalized eigenvalues of complex square matrices mA
and mB
. A generalized eigenvalue for a pair of matrices is a scalar or a ratio , such that is singular. It is usually represented as the pair , as there is a reasonable interpretation for and even for both being zero. The right generalized eigenvector corresponding to the generalized eigenvalue of satisfies
The left generalized eigenvector corresponding to the generalized eigenvalue of satisfies
Function returns reference to the vector changed and throws cvmexception in case of inappropriate calling object sizes or in case of convergence error.
[in] | mA | scmatrix . |
[in] | mB | scmatrix . |
[out] | vBeta | computed values. |
[out] | mEigVectLeft | computed left eigenvectors stored by columns. |
[out] | mEigVectRight | computed right eigenvectors stored by columns. |
Definition at line 9566 of file cvm.h.
|
inline |
Generalized eigenvalues of complex matrices.
Solves generalized eigenvalue problem and sets calling complex vector to be equal to generalized eigenvalues of complex square matrices mA
and mB
. A generalized eigenvalue for a pair of matrices is a scalar or a ratio , such that is singular. It is usually represented as the pair , as there is a reasonable interpretation for and even for both being zero. The right generalized eigenvector corresponding to the generalized eigenvalue of satisfies
The left generalized eigenvector corresponding to the generalized eigenvalue of satisfies
Function returns reference to the vector changed and throws cvmexception in case of inappropriate calling object sizes or in case of convergence error.
[in] | mA | scmatrix . |
[in] | mB | scmatrix . |
[out] | vBeta | computed values. |
[out] | mEigVect | computed left or right eigenvectors stored by columns. |
[in] | bRightVect | true to compute right eigenvectors, false to compute left ones. |
Definition at line 9659 of file cvm.h.
|
inline |
Generic matrix-vector operation.
Calls one of ZGEMV
routines of the BLAS Library performing matrix-vector operation defined as
where and are complex numbers (parameters dAlpha
and dBeta
), is matrix (parameter m
) and and are vectors (parameter v
and calling vector respectively). First operation is performed if bLeft
passed is false
and second one otherwise. Function returns reference to the vector changed and throws cvmexception in case of inappropriate sizes of the operands.
[in] | bLeft | Is left-sided multiplication. |
[in] | m | cmatrix . |
[in] | dAlpha | Number . |
[in] | v | cvector . |
[in] | dBeta | Number . |
Definition at line 9725 of file cvm.h.
|
inline |
Generic band matrix-vector operation.
Calls one of ZGBMV
routines of the BLAS Library performing matrix-vector operation defined as
where and are complex numbers (parameters dAlpha
and dBeta
), is band matrix (parameter m
) and and are vectors (parameter v
and calling vector respectively). First operation is performed if bLeft
passed is false
and second one otherwise. Function returns reference to the vector changed and throws cvmexception in case of inappropriate sizes of the operands.
[in] | bLeft | Is left-sided multiplication. |
[in] | m | scbmatrix . |
[in] | dAlpha | Number . |
[in] | v | cvector . |
[in] | dBeta | Number . |
Definition at line 9786 of file cvm.h.
|
inline |
Randomizer (real part)
Fills real part of calling complex vector with pseudo-random numbers distributed between dFrom
and dTo
. It returns reference to the vector changed.
[in] | dFrom | First limit. |
[in] | dTo | Second limit. |
Definition at line 9817 of file cvm.h.
|
inline |
Randomizer (imaginary part)
Fills imaginary part of calling complex vector with pseudo-random numbers distributed between dFrom
and dTo
. It returns reference to the vector changed.
[in] | dFrom | First limit. |
[in] | dTo | Second limit. |
Definition at line 9846 of file cvm.h.