-
Notifications
You must be signed in to change notification settings - Fork 0
/
mathmatrix.h
61 lines (47 loc) · 1.88 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
#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& 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 inverted() const;
MathMatrix& invert();
double* internal_pointer() const;
static MathMatrix identity(unsigned int size);
static MathMatrix diagonal(const std::initializer_list<double>& ditems);
private:
Data * d;
};
MathMatrix operator*(double x, MathMatrix& m);
MathMatrix operator/(double x, MathMatrix& m);
#endif // MATHMATRIX_H