32 #define endll endl << endl
43 Matrix (
const int32_t m,
const int32_t n);
44 Matrix (
const int32_t m,
const int32_t n,
const FLOAT* val_);
45 Matrix (
const Matrix &M);
49 Matrix& operator= (
const Matrix &M);
52 void getData(FLOAT* val_,int32_t i1=0,int32_t j1=0,int32_t i2=-1,int32_t j2=-1);
55 Matrix getMat(int32_t i1,int32_t j1,int32_t i2=-1,int32_t j2=-1);
56 void setMat(
const Matrix &M,
const int32_t i,
const int32_t j);
59 void setVal(FLOAT s,int32_t i1=0,int32_t j1=0,int32_t i2=-1,int32_t j2=-1);
62 void setDiag(FLOAT s,int32_t i1=0,int32_t i2=-1);
68 Matrix extractCols (std::vector<int> idx);
71 static Matrix eye (
const int32_t m);
75 static Matrix diag(
const Matrix &M);
78 static Matrix reshape(
const Matrix &M,int32_t m,int32_t n);
81 static Matrix rotMatX(
const FLOAT &angle);
82 static Matrix rotMatY(
const FLOAT &angle);
83 static Matrix rotMatZ(
const FLOAT &angle);
86 Matrix operator+ (
const Matrix &M);
87 Matrix operator- (
const Matrix &M);
88 Matrix operator* (
const Matrix &M);
89 Matrix operator* (
const FLOAT &s);
90 Matrix operator/ (
const Matrix &M);
91 Matrix operator/ (
const FLOAT &s);
98 static Matrix cross (
const Matrix &a,
const Matrix &b);
99 static Matrix inv (
const Matrix &M);
102 bool solve (
const Matrix &M,FLOAT eps=1e-20);
103 bool lu(int32_t *idx, FLOAT &d, FLOAT eps=1e-20);
104 void svd(Matrix &U,Matrix &W,Matrix &V);
107 friend std::ostream& operator<< (std::ostream& out,
const Matrix& M);
115 void allocateMemory (
const int32_t m_,
const int32_t n_);
116 void releaseMemory ();
117 inline FLOAT pythag(FLOAT a,FLOAT b);