My Project
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | List of all members
MatrixVector::mat Class Reference

Classes

class  Loader
 Inspired from Eigen Lib. More...
 

Public Member Functions

 mat (const mat &m)
 
 mat (const int col, const int row)
 
 mat (vector< vector< float > > v2)
 
 mat (const int col, const int row, vector< float > v)
 
Loader operator<< (float x)
 
vector< vector< float > > toVecVec ()
 
vec getVec (int n)
 
row getRow (int n)
 Get an index row from a matrix.
 
vec operator* (vec &v)
 
mat operator* (mat m)
 
mat operator= (const mat &m)
 
bool operator== (const mat &m)
 
mat operator+ (mat m)
 
mat operator- (const mat &m)
 
mat operator/ (float f)
 
mat operator* (float f)
 
mat removeRow (int index)
 
mat removeVec (int index)
 Get an index Column or Vector from a matrix.
 
mat insertVecNext (int index, vec v)
 Add vector to the right of index, Should I change the name to insertVecRight()
 
mat insertVecPrevious (int index, vec v)
 
mat clone ()
 
mat concat (mat m)
 
mat rowMultiScala (int index, float f)
 
mat vecMultiScala (int index, float f)
 
mat swapRow (int inx1, int inx2)
 Add test cases.
 
void geneMat (int init)
 Generate matrix from init to ncol*nrow.
 
void geneMatRandom (int fst, int snd)
 Generate a random matrix in interval @fst and @snd [fst, snd)
 
void print ()
 print the matrix
 
string toStr ()
 
void print2 ()
 
void zero ()
 
void identity ()
 
bool isId ()
 
bool isZero ()
 
float det ()
 
mat id ()
 
mat subMatrix (int colIndex, int rowIndex)
 /Library/WebServer/Documents/zsurface/pdf/submatrix_get.pdf 1 2 3 subMatrix(1, 0) => 4 5 6 4 5 6
 
mat transpose ()
 tranpose matrix
 
mat block (int colIndex, int clen, int rowIndex, int rlen)
 subblock of a matrix
 
mat take (int len)
 Take first n columns from a matrix.
 
mat drop (int len)
 Drop first n columns from a matrix.
 
mat init ()
 Drop the last column from a matrix.
 
mat tail ()
 Drop the first column from a matrix.
 
 mat (const mat &m)
 
 mat (const int col, const int row)
 
 mat (vector< vector< float > > v2)
 
 mat (const int col, const int row, vector< float > v)
 
Loader operator<< (float x)
 
vec getVec (int n)
 
row getRow (int n)
 
vec operator* (vec &v)
 
mat operator* (mat &m)
 
mat operator= (const mat &m)
 
bool operator== (const mat &m)
 
mat operator+ (mat m)
 
mat operator- (const mat &m)
 
mat operator/ (float f)
 
mat operator* (float f)
 
mat removeRow (int index)
 
mat removeVec (int index)
 
mat insertVecNext (int index, vec v)
 
mat insertVecPrevious (int index, vec v)
 
mat clone ()
 
mat concat (mat m)
 
mat rowMultiScala (int index, float f)
 
mat vecMultiScala (int index, float f)
 
mat swapRow (int inx1, int inx2)
 
void geneMat (int init)
 
void geneMatRandom (int fst, int snd)
 
void print ()
 
string toStr ()
 
void print2 ()
 
void zero ()
 
void identity ()
 
bool isId ()
 
bool isZero ()
 
float det ()
 
mat id ()
 
mat subMatrix (int colIndex, int rowIndex)
 /Library/WebServer/Documents/zsurface/pdf/submatrix_get.pdf 1 2 3 subMatrix(1, 0) => 4 5 6 4 5 6
 
mat transpose ()
 
mat block (int colIndex, int clen, int rowIndex, int rlen)
 
mat take (int len)
 
mat drop (int len)
 
mat init ()
 
mat tail ()
 

Public Attributes

int ncol
 
int nrow
 
float ** arr
 

Member Function Documentation

◆ block()

mat MatrixVector::mat::block ( int  cIndex,
int  clen,
int  rIndex,
int  rlen 
)

subblock of a matrix

  • [..) + [..]
  • Idea is from substring(index, n = inde + 1)
    "abc".substring(0, 2) => "ab"
    "abc".substring(2, 3) => "c"

◆ drop()

mat MatrixVector::mat::drop ( int  len)

Drop first n columns from a matrix.

- mat m(nrow, nrow)
- drop(nrow) => m(ncol, 0)
Definition: AronLib.h:3604
mat drop(int len)
Drop first n columns from a matrix.
Definition: AronLib.h:4061

◆ geneMat()

void MatrixVector::mat::geneMat ( int  init)

Generate matrix from init to ncol*nrow.

init = 1, ncol = 2, nrow = 3
1 2 3
3 4 5
mat init()
Drop the last column from a matrix.
Definition: AronLib.h:4080

◆ geneMatRandom()

void MatrixVector::mat::geneMatRandom ( int  fst,
int  snd 
)

Generate a random matrix in interval @fst and @snd [fst, snd)

@fst @snd

init = 1, ncol = 2, nrow = 3
1 2 3
3 4 5
geneMatRandom(1, 10) => [1, 10)
void geneMatRandom(int fst, int snd)
Generate a random matrix in interval @fst and @snd [fst, snd)
Definition: AronLib.h:4189

@fst @snd

init = 1, ncol = 2, nrow = 3
1 2 3
3 4 5
geneMatRandom(1, 10) => [1, 10)

◆ getVec()

vec MatrixVector::mat::getVec ( int  n)

get 0 <= n <= nrow vector or column from matrix

◆ init()

mat MatrixVector::mat::init ( )

Drop the last column from a matrix.

\[ \begin{bmatrix} a & b & c \\ c & d & e \\ f & g & h \end{bmatrix} \rightarrow \begin{bmatrix} a & b \\ c & d \\ f & g \end{bmatrix} \]

\[ \begin{bmatrix} a & b & c \\ c & d & e \\ f & g & h \end{bmatrix} \rightarrow \begin{bmatrix} a & b \\ c & d \\ f & g \end{bmatrix} \]

◆ print()

void MatrixVector::mat::print ( )

print the matrix

int ncol = 2;
int nrow = 3;
mat m(ncol, nrow);
m.geneMat(1);
for(int i=0; i< ncol; i++){
for(int j=0; j< nrow; j++){
int indent = 10;
printf("[%*f]", 10, m.arr[i][j]);
}
printf("\n");
}
m.print();

◆ subMatrix()

mat MatrixVector::mat::subMatrix ( int  cStart,
int  rStart 
)

/Library/WebServer/Documents/zsurface/pdf/submatrix_get.pdf 1 2 3 subMatrix(1, 0) => 4 5 6 4 5 6

subblock matrix, submatrix 1 2 3 3 4 5 block(1, 1)=> 4 5 6 7 8 7 8

◆ tail()

mat MatrixVector::mat::tail ( )

Drop the first column from a matrix.

\[ \begin{bmatrix} a & b & c \\ c & d & e \\ f & g & h \end{bmatrix} \rightarrow \begin{bmatrix} b & c \\ d & e \\ h & h \end{bmatrix} \]

\[ \begin{bmatrix} a & b & c \\ c & d & e \\ f & g & h \end{bmatrix} \rightarrow \begin{bmatrix} b & c \\ d & e \\ h & h \end{bmatrix} \]

◆ take()

mat MatrixVector::mat::take ( int  len)

Take first n columns from a matrix.

mat m(nrow, nrow)
take(0) => m(ncol, 0)
mat take(int len)
Take first n columns from a matrix.
Definition: AronLib.h:4049

◆ transpose() [1/2]

mat MatrixVector::mat::transpose ( )

tranpose matrix

1 2 3 => 1 4 4 5 6 2 5 3 6

--------------------------------------------------------------------------------
1 2 3 1 4
4 5 6 => 2 5
3 6
--------------------------------------------------------------------------------

◆ transpose() [2/2]

mat MatrixVector::mat::transpose ( )

1 2 3 => 1 4 4 5 6 2 5 3 6


The documentation for this class was generated from the following files: