Cubli library
Matrix/Matrix.h@2:dc7840a67f77, 2019-02-25 (annotated)
- Committer:
- fbob
- Date:
- Mon Feb 25 16:39:52 2019 +0000
- Revision:
- 2:dc7840a67f77
- Parent:
- 1:085840a3d767
Update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fbob | 0:431ee55036ca | 1 | #ifndef Matrix_h |
fbob | 0:431ee55036ca | 2 | #define Matrix_h |
fbob | 0:431ee55036ca | 3 | |
fbob | 0:431ee55036ca | 4 | #include "stdlib.h" |
fbob | 1:085840a3d767 | 5 | #include "math.h" |
fbob | 0:431ee55036ca | 6 | |
fbob | 1:085840a3d767 | 7 | /** Matrix class */ |
fbob | 0:431ee55036ca | 8 | class Matrix |
fbob | 0:431ee55036ca | 9 | { |
fbob | 2:dc7840a67f77 | 10 | public: |
fbob | 1:085840a3d767 | 11 | /** Constructors */ |
fbob | 0:431ee55036ca | 12 | Matrix(); |
fbob | 2:dc7840a67f77 | 13 | Matrix(int, int); |
fbob | 1:085840a3d767 | 14 | /** Destructor */ |
fbob | 0:431ee55036ca | 15 | ~Matrix(); |
fbob | 1:085840a3d767 | 16 | /** Assignment */ |
fbob | 2:dc7840a67f77 | 17 | Matrix& operator=(const Matrix&); |
fbob | 2:dc7840a67f77 | 18 | /** Cell data */ |
fbob | 2:dc7840a67f77 | 19 | float& operator()(int, int); |
fbob | 1:085840a3d767 | 20 | /** Parameters */ |
fbob | 2:dc7840a67f77 | 21 | int rows, cols; |
fbob | 2:dc7840a67f77 | 22 | float **data; |
fbob | 2:dc7840a67f77 | 23 | private: |
fbob | 2:dc7840a67f77 | 24 | /** Memmory managment **/ |
fbob | 2:dc7840a67f77 | 25 | void allocate_memmory(); |
fbob | 2:dc7840a67f77 | 26 | void deallocate_memmory(); |
fbob | 0:431ee55036ca | 27 | }; |
fbob | 0:431ee55036ca | 28 | |
fbob | 1:085840a3d767 | 29 | /** Math operators */ |
fbob | 0:431ee55036ca | 30 | Matrix operator+(const Matrix&, const Matrix&); |
fbob | 0:431ee55036ca | 31 | Matrix operator-(const Matrix&, const Matrix&); |
fbob | 2:dc7840a67f77 | 32 | Matrix operator-(const Matrix&); |
fbob | 0:431ee55036ca | 33 | Matrix operator*(const Matrix&, const Matrix&); |
fbob | 0:431ee55036ca | 34 | Matrix operator*(float, const Matrix&); |
fbob | 1:085840a3d767 | 35 | Matrix operator*(const Matrix&, float); |
fbob | 1:085840a3d767 | 36 | Matrix operator/(const Matrix&, float); |
fbob | 0:431ee55036ca | 37 | |
fbob | 1:085840a3d767 | 38 | /** Matriz algebra */ |
fbob | 2:dc7840a67f77 | 39 | Matrix eye(int, int = 0); |
fbob | 2:dc7840a67f77 | 40 | Matrix zeros(int, int = 0); |
fbob | 0:431ee55036ca | 41 | Matrix transpose(const Matrix&); |
fbob | 0:431ee55036ca | 42 | Matrix inverse(const Matrix&); |
fbob | 2:dc7840a67f77 | 43 | float trace(const Matrix&); |
fbob | 2:dc7840a67f77 | 44 | |
fbob | 2:dc7840a67f77 | 45 | /** Vector algebra **/ |
fbob | 2:dc7840a67f77 | 46 | Matrix cross(const Matrix&, const Matrix&); |
fbob | 1:085840a3d767 | 47 | float norm(const Matrix&); |
fbob | 0:431ee55036ca | 48 | |
fbob | 2:dc7840a67f77 | 49 | /** Orientation algebra **/ |
fbob | 2:dc7840a67f77 | 50 | Matrix dcm2quat(const Matrix&); |
fbob | 2:dc7840a67f77 | 51 | |
fbob | 0:431ee55036ca | 52 | #endif |