-
Notifications
You must be signed in to change notification settings - Fork 0
/
Matrix.h
51 lines (42 loc) · 1.2 KB
/
Matrix.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
// Matrix.h
#ifndef MATRIX_H
#define MATRIX_H
#include <iostream>
#include <cmath>
// You don't have to use the struct. Can help you with MlpNetwork.h
typedef struct matrix_dims {
int rows, cols;
}matrix_dims;
// Insert Matrix class here...
class Matrix{
private:
float *matrix;
int rows;
int cols;
public:
Matrix(int rows,int cols);
Matrix();
Matrix(Matrix const &m);
~Matrix();
int get_rows() const;
int get_cols() const;
Matrix transpose();
void plain_print();
Matrix& vectorize();
Matrix dot(Matrix const &m);
float norm();
Matrix rref();
int argmax() const;
float sum() const;
Matrix& operator+=(const Matrix& m);
friend Matrix operator+(const Matrix& m1 ,const Matrix& m2);
Matrix& operator=(const Matrix &m);
friend Matrix operator*(const Matrix& m1,const Matrix& m2);
friend Matrix operator*(const Matrix& m,float scalar);
friend Matrix operator*(float scalar,const Matrix& m);
float& operator()(int i,int j) const;
float& operator [](int k) const;
friend std::ostream & operator<<(std::ostream& printed,Matrix &m);
friend std:: istream & operator>>(std::istream& printed, Matrix &m);
};
#endif //MATRIX_H