Optimization
[GPXSee.git] / src / map / matrix.h
blob86c108d54757f704a1458201ac7136b05a9daf03
1 #ifndef MATRIX_H
2 #define MATRIX_H
4 #include <cstddef>
5 #include <cfloat>
6 #include <QDebug>
8 class Matrix
10 public:
11 Matrix() {_h = 0; _w = 0; _m = 0;}
12 Matrix(size_t h, size_t w);
13 Matrix(const Matrix& M);
14 ~Matrix();
16 size_t h() const {return _h;}
17 size_t w() const {return _w;}
18 double &m(size_t i, size_t j) {return _m[_w * i + j];}
19 double const &m(size_t i, size_t j) const {return _m[_w * i + j];}
21 bool isNull() const {return (_h == 0 || _w == 0);}
23 void zeroize();
24 bool eliminate(double epsilon = DBL_EPSILON);
25 Matrix augemented(const Matrix &M) const;
27 private:
28 double *_m;
29 size_t _h;
30 size_t _w;
33 #ifndef QT_NO_DEBUG
34 QDebug operator<<(QDebug dbg, const Matrix &matrix);
35 #endif // QT_NO_DEBUG
37 #endif // MATRIX_H