-
Notifications
You must be signed in to change notification settings - Fork 0
/
mathmatrix.h
65 lines (51 loc) · 2.08 KB
/
mathmatrix.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef MATHMATRIX_H
#define MATHMATRIX_H
#include "mathmatrix_global.h"
struct Data;
class MATHMATRIXSHARED_EXPORT MathMatrix {
public:
MathMatrix();
MathMatrix(unsigned int rows, unsigned int cols);
MathMatrix(const MathMatrix& matrix);
~MathMatrix();
unsigned int rows() const;
unsigned int columns() const;
double at(unsigned int r, unsigned int c) const;
void setItem(unsigned int r, unsigned int c, double value);
void setRow(unsigned int r, const std::initializer_list<double>& list);
void setColumn(unsigned int c, const std::initializer_list<double>& list);
void setMatrix(const std::initializer_list<std::initializer_list<double>>& matrix);
MathMatrix clone() const;
MathMatrix& swapRows(unsigned int row1, unsigned int row2);
MathMatrix& swapColumns(unsigned int row1, unsigned int row2);
MathMatrix& operator=(const MathMatrix& matrix);
const double& operator()(unsigned int r, unsigned int c) const;
double& operator()(unsigned int r, unsigned int c);
MathMatrix operator+(const MathMatrix& m) const;
MathMatrix operator-(const MathMatrix& m) const;
MathMatrix operator*(double x) const;
MathMatrix operator*(const MathMatrix& m) const;
MathMatrix operator/(double x) const;
MathMatrix& operator+=(const MathMatrix& m);
MathMatrix& operator-=(const MathMatrix& m);
MathMatrix& operator*=(double x);
MathMatrix& operator/=(double x);
MathMatrix& operator++();
MathMatrix& operator--();
double trace() const;
double determinant() const;
MathMatrix subMatrix(unsigned int row, unsigned int column) const;
MathMatrix transposed() const;
MathMatrix& transpose();
MathMatrix inverse() const;
MathMatrix& invert();
static MathMatrix identity(unsigned int size);
static MathMatrix diagonal(const std::initializer_list<double>& ditems);
operator QString() const;
double* internal_pointer() const;
private:
Data * d;
};
MathMatrix operator*(double x, const MathMatrix& m);
MathMatrix operator/(double x, const MathMatrix& m);
#endif // MATHMATRIX_H