-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatrix.h
More file actions
39 lines (35 loc) · 1.31 KB
/
Copy pathMatrix.h
File metadata and controls
39 lines (35 loc) · 1.31 KB
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
#pragma once
#include <chrono>
class Matrix
{
friend class Genome;
friend class Network;
friend class Snake;
public:
Matrix();
Matrix(size_t a, size_t b); //creates a matrix with undefined values
Matrix(size_t a, size_t b, double mean, double stddev); //creates a matrix filled with numbers following normal disrtibution of parameters mean and stddev
Matrix(size_t a, size_t b, double* tab); //creates a matrix from a double array
Matrix(const Matrix& other);
~Matrix();
double at(size_t i, size_t j) const; //access to an element of the matrix
double& at(size_t i, size_t j);
double getHeight();
double getWidth();
void setValues(double* tab); //fill the matrix from a double array
bool operator==(const Matrix& other);
Matrix operator+(const Matrix& other) const;
Matrix operator-(const Matrix& other) const;
Matrix& operator=(const Matrix& other);
Matrix operator*(const Matrix& other) const; //term to term (or hadamard) product
Matrix& operator+=(const Matrix& other);
Matrix& operator-=(const Matrix& other);
static Matrix dot(const Matrix& A, const Matrix& B); //dot product
static Matrix uniform(const Matrix& A, double val);
static Matrix sigmoid(const Matrix& A);
static Matrix arctan(const Matrix& A);
void display(); //displays the matrix
private:
size_t Height, Width;
double* values;
};