Vector of generic size. More...
#include <fMatrix.h>
Public Member Functions | |
void | abs () |
Converts all elements to their absolute values. More... | |
fVec () | |
fVec (int m, double *ini=0) | |
fVec (int m, double ini) | |
fVec (const fVec &ini) | |
void | get_subvec (int start, const fVec &allV) |
Copy a sub-vector of a larger vector. More... | |
double | length () const |
Length of the vector. More... | |
int | lineq (const fMat &A, const fVec &b) |
Solves linear equation Ax = b. More... | |
int | lineq_porfs (const fMat &A, const fVec &b) |
int | lineq_posv (const fMat &A, const fVec &b) |
int | lineq_sr (const fMat &A, fVec &w_err, fVec &w_norm, double k, const fVec &b) |
int | lineq_svd (const fMat &A, const fVec &b, int lwork=-1) |
int | max_index () |
Returns the index of the largest element. More... | |
double | max_value () |
Returns the maximum value. More... | |
int | min_index () |
Returns the index of the smallest element. More... | |
double | min_value () |
Returns the minimum value. More... | |
double & | operator() (int i) |
Returns the reference to the i-th element. More... | |
double | operator() (int i) const |
Returns the value of the i-th element. More... | |
void | operator= (double d) |
Assignment operations. More... | |
fVec | operator= (const fVec &vec) |
void | resize (int i) |
Change the size. More... | |
void | set (double *_d) |
Sets all elements. More... | |
void | set_subvec (int start, const fVec &subV) |
Copy a smaller vector as a sub-vector. More... | |
int | size () const |
Size of the vector (same as row()). More... | |
double | sum () |
Returns the sum of the elements. More... | |
void | unit () |
Converts to a unit vector (no length check!). More... | |
void | zero () |
Creates a zero vector. More... | |
~fVec () | |
Functions | |
Operators in function forms (faster). | |
void | set (const fVec &vec) |
void | neg (const fVec &vec) |
void | add (const fVec &vec1, const fVec &vec2) |
void | add (const fVec &vec) |
void | sub (const fVec &vec1, const fVec &vec2) |
void | div (const fVec &vec, double d) |
void | mul (const fVec &vec, double d) |
void | mul (double d, const fVec &vec) |
void | mul (const fMat &mat, const fVec &vec) |
M * v. More... | |
void | mul (const fVec &vec, const fMat &mat) |
v^T * M More... | |
Public Member Functions inherited from fMat | |
int | col () const |
Returns the number of columns. More... | |
double * | data () const |
Returns the pointer to the first element. More... | |
void | ddiv (const fMat &mat1, const fMat &mat2) |
Element-wise division: ./ operator in MATLAB. More... | |
double | det (void) |
Computes the determinant. More... | |
void | dmul (const fMat &mat1, const fMat &mat2) |
Element-wise multiplication: .* operator in MATLAB. More... | |
int | eig (fVec &wr, fVec &wi) |
Computes the eigenvalues. More... | |
int | eig (fVec &wr, fVec &wi, fMat &v) |
Computes the eigenvalues and eigenvectors. More... | |
int | eig (fVec &wr, fVec &wi, fMat &vr, fMat &vi) |
Computes the eigenvalues and eigenvectors. More... | |
fMat () | |
Default constructor. More... | |
fMat (int m, int n, double *ini=0) | |
Constructor with size and initial values (optional). More... | |
fMat (int m, int n, double ini) | |
Constructor with size and common initial values. More... | |
fMat (const fMat &ini) | |
Copy constructor. More... | |
fMat (const fVec &ini) | |
Constructor from a vector. More... | |
void | get_submat (int row_start, int col_start, const fMat &allM) |
Extract a sub-matrix and set to myself. More... | |
void | identity () |
Creates an identity matrix (only for square matrices). More... | |
int | info () |
Returns the value of m_info. More... | |
int | inv_porfs (const fMat &) |
inverse of positive-definite, symmetric matrix More... | |
int | inv_posv (const fMat &) |
inverse of positive-definite, symmetric matrix More... | |
int | lineq_porfs (const fMat &A, const fMat &b) |
solve linear equation Ax = b, where A is positive-definite, symmetric More... | |
int | lineq_posv (const fMat &A, const fMat &b) |
solve linear equation Ax = b, where A is positive-definite, symmetric More... | |
operator double * () | |
Converts to an array of double. More... | |
double & | operator() (int i, int j) |
Returns the (non-constant) reference to the (i,j) element. More... | |
double | operator() (int i, int j) const |
Returns the value of the (i,j) element. More... | |
fMat | operator= (const fMat &mat) |
Assignment from a reference matrix. More... | |
void | operator= (double d) |
Assigns the same value to all elements. More... | |
int | resize (int i, int j) |
Changes the matrix size. More... | |
int | row () const |
Returns the number of rows. More... | |
void | set (double *_d) |
Sets the values from an array. More... | |
void | set_submat (int row_start, int col_start, const fMat &subM) |
Sets a sub-matrix of myself. More... | |
void | setinfo (int _info) |
Sets m_info. More... | |
int | svd (fMat &U, fVec &Sigma, fMat &VT) |
singular value decomposition More... | |
void | symmetric (char t= 'U') |
Change to symmetric matrix. More... | |
void | tran (const fMat &mat) |
Sets the transpose of a matrix. More... | |
void | tran () |
Transposes a matrix (only for square matrices). More... | |
void | zero () |
Creates a zero matrix. More... | |
~fMat () | |
Destructor. More... | |
void | set (const fMat &mat) |
void | neg (const fMat &mat) |
void | add (const fMat &mat1, const fMat &mat2) |
void | add (const fMat &mat) |
void | sub (const fMat &mat1, const fMat &mat2) |
void | mul (const fMat &mat1, const fMat &mat2) |
void | mul (double d, const fMat &mat) |
void | mul (const fMat &mat, double d) |
void | mul_tran (const fMat &mat1, int trans_first) |
void | div (const fMat &mat, double d) |
int | inv (const fMat &) |
inverse More... | |
int | p_inv (const fMat &) |
pseudo inverse More... | |
int | sr_inv (const fMat &mat, fVec &w_err, fVec &w_norm, double k) |
singularity-robust (SR) inverse More... | |
int | lineq (const fMat &A, const fMat &b) |
solve linear equation Ax = b More... | |
int | lineq_sr (const fMat &A, fVec &w_err, fVec &w_norm, double k, const fMat &b) |
solve linear equation Ax = b using SR-inverse More... | |
int | inv_svd (const fMat &, int lwork=-1) |
inverse More... | |
int | p_inv_svd (const fMat &, int lwork=-1) |
pseudo inverse More... | |
int | sr_inv_svd (const fMat &mat, fVec &w_err, fVec &w_norm, double k, int lwork=-1) |
SR-inverse. More... | |
int | lineq_svd (const fMat &A, const fMat &b, int lwork=-1) |
solve linear equation Ax = b More... | |
void | operator+= (const fMat &mat) |
void | operator-= (const fMat &mat) |
void | operator*= (double d) |
void | operator/= (double d) |
Friends | |
double | length (const fVec &v) |
Length of the vector. More... | |
fVec | unit (const fVec &v) |
Returns a unit vector with the same direction (no length check!). More... | |
Operators | |
void | operator+= (const fVec &vec) |
void | operator-= (const fVec &vec) |
void | operator*= (double d) |
void | operator/= (double d) |
fVec | operator- (const fVec &vec) |
fVec | operator+ (const fVec &vec1, const fVec &vec2) |
fVec | operator- (const fVec &vec1, const fVec &vec2) |
fVec | operator/ (const fVec &vec, double d) |
fVec | operator* (double d, const fVec &vec) |
fVec | operator* (const fVec &vec, double d) |
double | operator* (const fVec &vec1, const fVec &vec2) |
Additional Inherited Members | |
Protected Attributes inherited from fMat | |
int | m_info |
int | n_col |
int | n_row |
double * | p_data |
double | temp |
void fVec::abs | ( | ) |
Converts all elements to their absolute values.
Definition at line 1510 of file fMatrix.cpp.
Definition at line 1562 of file fMatrix.cpp.
Definition at line 1568 of file fMatrix.cpp.
Definition at line 1599 of file fMatrix.cpp.
Copy a sub-vector of a larger vector.
Definition at line 65 of file fMatrix.cpp.
|
inline |
Solves linear equation Ax = b.
Definition at line 163 of file fMatrix.cpp.
Definition at line 788 of file fMatrix.cpp.
Definition at line 869 of file fMatrix.cpp.
Definition at line 468 of file fMatrix.cpp.
int fVec::max_index | ( | ) |
double fVec::max_value | ( | ) |
Returns the maximum value.
Definition at line 1478 of file fMatrix.cpp.
int fVec::min_index | ( | ) |
Returns the index of the smallest element.
Definition at line 1462 of file fMatrix.cpp.
double fVec::min_value | ( | ) |
Returns the minimum value.
Definition at line 1494 of file fMatrix.cpp.
Definition at line 1620 of file fMatrix.cpp.
Definition at line 1626 of file fMatrix.cpp.
M * v.
Definition at line 1380 of file fMatrix.cpp.
v^T * M
Definition at line 1401 of file fMatrix.cpp.
Definition at line 1524 of file fMatrix.cpp.
|
inline |
|
inline |
void fVec::operator*= | ( | double | d | ) |
Definition at line 1552 of file fMatrix.cpp.
Definition at line 1539 of file fMatrix.cpp.
Definition at line 1546 of file fMatrix.cpp.
void fVec::operator/= | ( | double | d | ) |
Definition at line 1557 of file fMatrix.cpp.
void fVec::operator= | ( | double | d | ) |
Assignment operations.
Definition at line 1646 of file fMatrix.cpp.
Definition at line 1651 of file fMatrix.cpp.
Definition at line 1518 of file fMatrix.cpp.
Copy a smaller vector as a sub-vector.
Definition at line 76 of file fMatrix.cpp.
Definition at line 1583 of file fMatrix.cpp.
|
inline |
|
inline |
Definition at line 1632 of file fMatrix.cpp.
Definition at line 1639 of file fMatrix.cpp.
Definition at line 1612 of file fMatrix.cpp.
Definition at line 1574 of file fMatrix.cpp.
Definition at line 1531 of file fMatrix.cpp.
Definition at line 1590 of file fMatrix.cpp.
Definition at line 1605 of file fMatrix.cpp.