25 #ifndef _Matrix2x2_hh_
26 #define _Matrix2x2_hh_
27 #include "bias_config.h"
29 #include <Base/Debug/Error.hh>
45 template <
class T>
class BIASMathBase_EXPORT
Vector2;
47 template<
class T=
double>
57 this->v_[0] = this->v_[3] = T(1);
return;
60 BIASERR(
"undefined MatrixInitType");
80 const T a0,
const T a1,
81 const T a2,
const T a3);
101 Vector2<T> ret; MultLeft(argvec, ret);
return ret;
125 inline void TransposeIP();
128 inline void SetIdentity();
131 inline void SetZero();
140 inline T det()
const;
159 int EigenvalueDecomposition(T& value1,
Vector2<T>& vector1,
166 register T *dataP = this->GetData();
167 register const T *argP = arg.
GetData();
168 dataP[0] = argP[0]; dataP[3] = argP[3];
169 dataP[1] = argP[2]; dataP[2] = argP[1];
184 this->v_[1] = this->v_[2];
192 register T *destP = destmat.
GetData();
193 const register T *argP = argmat.
GetData();
194 const register T *matP = this->GetData();
197 matP[0] * argP[0] + matP[1] * argP[2];
199 matP[0] * argP[1] + matP[1] * argP[3];
202 matP[2] * argP[0] + matP[3] * argP[2];
204 matP[2] * argP[1] + matP[3] * argP[3];
211 const register T *argP = argmat.
GetData();
212 register T tmp = this->v_[0];
215 tmp * argP[0] + this->v_[1] * argP[2];
217 tmp * argP[1] + this->v_[1] * argP[3];
221 this->v_[2] * argP[0] + this->v_[3] * argP[2];
223 tmp * argP[1] + this->v_[3] * argP[3];
231 const register T *matP = this->GetData();
232 destvec[0] = argvec[0] * matP[0]
233 + argvec[1] * matP[1];
234 destvec[1] = argvec[0] * matP[2]
235 + argvec[1] * matP[3];
242 const register T *matP = this->GetData();
243 destvec[0] = argvec[0] * matP[0]
244 + argvec[1] * matP[2];
245 destvec[1] = argvec[0] * matP[1]
246 + argvec[1] * matP[3];
252 register T* d = this->GetData();
259 register T* d = this->GetData();
260 d[0]=d[1]=d[2]=d[3] =0;
268 register const T *dataP = this->GetData();
269 return (dataP[0] * dataP[3] - dataP[1] * dataP[2]);
275 #include "Operators.hh"
277 #endif // _Matrix2x2_hh_
void SetIdentity()
set the elements of this matrix to the identity matrix
MatrixInitType
can be passed to matrix constructors to init the matrix with the most often used values ...
T det() const
calculate the determinante
is a 'fixed size' quadratic matrix of dim.
void TransposeIP()
transpose matrix in place
void Mult(const Vector2< T > &argvec, Vector2< T > &destvec) const
matrix - vector multiplicate this matrix with Vector2, storing the result in destvec calculates: dest...
Matrix2x2< T > Transpose() const
returns transposed matrix
class Vector2 contains a Vector of dim.
Matrix2x2< T > Invert() const
void clear()
stl conform interface
void MultLeft(const Vector2< T > &argvec, Vector2< T > &destvec) const
matrix - vector multiplicate this matrix with Vector2, storing the result in destvec calculates: dest...
void MultIP(const Matrix2x2< T > &argmat)
Multiplication in place with argmat.
T * GetData()
get the pointer to the data array of the matrix (for faster direct memeory access) ...
matrix class with arbitrary size, indexing is row major.
Vector2< T > MultLeft(const Vector2< T > &argvec) const
transposed argvec multipied from left, wrapper function
void SetZero()
set the elements of this matrix to zero