-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMatrix.hpp
53 lines (46 loc) · 1.13 KB
/
Matrix.hpp
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
#ifndef MATRIX_H
#define MATRIX_H
#include <functional>
#include <vector>
using namespace std;
class Matrix {
double** _m;
public:
int rows, cols;
Matrix();
Matrix(int, int);
~Matrix();
double*& operator[](const int);
Matrix& operator+=(const double);
Matrix& operator+=(const Matrix&);
Matrix& operator-=(const double);
Matrix& operator-=(const Matrix&);
Matrix& operator*=(const double);
Matrix& operator*=(const Matrix&);
Matrix operator+(const double);
Matrix operator+(const Matrix&);
Matrix operator-(const double);
Matrix operator-(const Matrix&);
Matrix operator*(const double);
Matrix operator*(const Matrix&);
static Matrix identity(int);
void copy(Matrix&);
void dot(Matrix&, Matrix&);
void hadamard(Matrix&, Matrix&);
void applyFunction(function<double(double)>);
void initWith(double**, int, int);
void transpose();
void example(int);
void random();
void print();
void deconst();
private:
void add(double);
void add(Matrix);
Matrix subtract(double);
Matrix subtract(const Matrix&);
void multiply(double);
void multiply(Matrix);
static double _rand();
};
#endif