2017-03-18 01:30:31 +01:00
|
|
|
#ifndef MATRIX_H
|
|
|
|
#define MATRIX_H
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
#include <cfloat>
|
2017-08-14 11:16:48 +02:00
|
|
|
#include <QDebug>
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2018-03-08 02:24:10 +01:00
|
|
|
class Matrix
|
|
|
|
{
|
2017-03-18 01:30:31 +01:00
|
|
|
public:
|
|
|
|
Matrix() {_h = 0; _w = 0; _m = 0;}
|
|
|
|
Matrix(size_t h, size_t w);
|
|
|
|
Matrix(const Matrix& M);
|
|
|
|
~Matrix();
|
|
|
|
|
|
|
|
Matrix &operator=(const Matrix &M);
|
|
|
|
|
|
|
|
size_t h() const {return _h;}
|
|
|
|
size_t w() const {return _w;}
|
|
|
|
double &m(size_t i, size_t j) {return _m[_w * i + j];}
|
|
|
|
double const &m(size_t i, size_t j) const {return _m[_w * i + j];}
|
|
|
|
|
|
|
|
bool isNull() const {return (_h == 0 || _w == 0);}
|
|
|
|
|
|
|
|
void zeroize();
|
|
|
|
bool eliminate(double epsilon = DBL_EPSILON);
|
|
|
|
Matrix augemented(const Matrix &M) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
double *_m;
|
|
|
|
size_t _h;
|
|
|
|
size_t _w;
|
|
|
|
};
|
|
|
|
|
2018-02-13 23:03:18 +01:00
|
|
|
#ifndef QT_NO_DEBUG
|
2017-08-14 11:16:48 +02:00
|
|
|
QDebug operator<<(QDebug dbg, const Matrix &matrix);
|
2018-02-13 23:03:18 +01:00
|
|
|
#endif // QT_NO_DEBUG
|
2017-08-14 11:16:48 +02:00
|
|
|
|
2017-03-18 01:30:31 +01:00
|
|
|
#endif // MATRIX_H
|