-
Notifications
You must be signed in to change notification settings - Fork 2
/
squarematrix.h
54 lines (45 loc) · 1.13 KB
/
squarematrix.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
#ifndef MATRIX_H
#define MATRIX_H
//STL headers
#include <vector>
#include <random>
namespace qmatrixproduct {
/**
* @brief 2-dimensional square matrix class with double values
*/
class SquareMatrix
{
public:
/**
* @brief Matrix constructor
* @param m_size Matrix size
*/
explicit SquareMatrix(int m_size = 64);
/**
* @brief Change the size of matrix
* @param newSize new matrix size
*/
void changeSize(int newSize);
std::vector<double>& operator [](int row);
const std::vector<double>& operator [](int row) const;
SquareMatrix operator +(const SquareMatrix& other) const;
SquareMatrix operator -(const SquareMatrix& other) const;
SquareMatrix& operator =(const SquareMatrix& other);
/**
* @brief Get matrix size
* @return matrix size
*/
int size() const;
/**
* @brief Fill matrix with random int values from -10 to 10
*/
void randomize();
private:
/**
* @brief Internal data stored as vector of vectors
*/
std::vector<std::vector<double>> m_data;
int m_size;
};
} // namespace qmatrixproduct
#endif // MATRIX_H