My Project
|
Two dimensional array represents matrix, column and row vector. More...
Classes | |
class | mat |
class | row |
class | vec |
Functions | |
template<typename T > | |
T ** | allocateTemp (int ncol, int nrow) |
Allocate ncol, nrow two dimension array for any type, return a pointer. | |
template<typename T > | |
T ** | allocate (int ncol, int nrow) |
Allocate a matrix: height = ncol, width = nrow. | |
template<typename T > | |
T ** | vecVecToArrArr (vector< vector< T > > vv) |
Convert Vector< Vector<T> > to dynamic T**. | |
template<typename T > | |
vector< vector< T > > | arrArrToVecVec (T **arr, int ncol, int nrow) |
Convert T** arr to vector<vector<T>> v2. | |
mat | concat (mat m1, mat m2) |
mat | identity (int n) |
vec | backwardSubstitute (mat a, vec b) |
Backward Substitute. | |
mat | ltri (mat m, int index) |
Get the L triangle from a matrix. | |
std::pair< mat, mat > | utri (mat m) |
Assume the diagonal entries are not zero, compute the U triangle matrix Lk..(L2 (L1 A))= U TODO: fix the code if a_{ii} = 0. | |
mat | geneMat (int ncol, int nrow, int init) |
mat | geneMatRandom (int ncol, int nrow, int fst, int snd) |
Generate random matrix in interval from fst to snd. | |
Two dimensional array represents matrix, column and row vector.
T ** MatrixVector::allocate | ( | int | ncol, |
int | nrow | ||
) |
Allocate a matrix: height = ncol, width = nrow.
ncol | is the height of matrix |
nrow | is the width of matrix |
T ** MatrixVector::allocateTemp | ( | int | ncol, |
int | nrow | ||
) |
Allocate ncol, nrow two dimension array for any type, return a pointer.
ncol | is number of column |
nrow | is number of row |
TODO: Change ncol => width nrow => heigh
ncol | is number of column |
nrow | is number of row |
vector< vector< T > > MatrixVector::arrArrToVecVec | ( | T ** | arr, |
int | ncol, | ||
int | nrow | ||
) |
Convert T** arr to vector<vector<T>> v2.
Use std::move() ?
Use std::move() ?
Backward Substitute.
[int] | a - upper triangle |
[int] | b - column vector |
\[ Ax = b \]
[int] | a - upper triangle |
[int] | b - column vector |
\[ Ax = b \]
mat MatrixVector::geneMatRandom | ( | int | ncol, |
int | nrow, | ||
int | fst, | ||
int | snd | ||
) |
Generate random matrix in interval from fst to snd.
Get the L triangle from a matrix.
\[ \begin{equation} \begin{aligned} &v_k = \begin{bmatrix} 0 \\ \vdots \\ 0 \\ l_{k+1,k} \\ l_{k+2,k} \\ \vdots \\ l_{m,k} \\ \end{bmatrix} \\ &v_k e_{k}^{*} = \begin{bmatrix} 0 & & & & \\ & \ddots & & & \\ & & 0 & & \\ & & l_{k+1,k} & & \\ & & \vdots & \ddots & \\ & & l_{m,k} & & 0 \\ \end{bmatrix} \\ \end{aligned} \end{equation} \]
\[ \begin{equation} \begin{aligned} &v_k = \begin{bmatrix} 0 \\ \vdots \\ 0 \\ l_{k+1,k} \\ l_{k+2,k} \\ \vdots \\ l_{m,k} \\ \end{bmatrix} \\ &v_k e_{k}^{*} = \begin{bmatrix} 0 & & & & \\ & \ddots & & & \\ & & 0 & & \\ & & l_{k+1,k} & & \\ & & \vdots & \ddots & \\ & & l_{m,k} & & 0 \\ \end{bmatrix} \\ \end{aligned} \end{equation} \]
T ** MatrixVector::vecVecToArrArr | ( | vector< vector< T > > | vv | ) |
Convert Vector< Vector<T> > to dynamic T**.
vv | is vector of vector type. |