-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmatrix.h
89 lines (62 loc) · 1.54 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
_____ __ _____
| | | | _ |
| | | | |__| __|
|_|_|_|_____|__| C++11 Standard
Multilayer perceptron (MLP) with backpropagation
A very simple implementation of artificial neural network
Written by Emilio Schinina' (emilioschi@gmail.com), JAN 2019
File: matrix.h
*/
#ifndef _MATRIX_H_
#define _MATRIX_H_
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include "utils.h"
#define _DEBUG_MATRIX_ false
#define ARRAY(...) ((double []){__VA_ARGS__})
class matrix {
private:
double* data;
int row;
int column;
int length;
public:
// Constructor
matrix(int r = 0, int c = 0);
matrix(int r, int c, double* array);
//matrix(char*); // file2matrix
// Copy Constructor
matrix(const matrix& source);
matrix operator+(const matrix& source);
matrix operator+(double value);
matrix operator-(const matrix& source);
matrix operator*(const matrix& source);
matrix operator*(double scale);
// Overloaded Assignment
matrix& operator=(const matrix& source);
// Destructor
~matrix();
void print(std::string str = "");
void randmatrix(double, double);
void scale(double);
void dot(matrix);
matrix transpose();
double getvalue(int, int);
void setvalue(int, int, double);
int getheight () {return row;}
int getwidth () {return column;}
matrix strip_row(int i);
matrix strip_column(int i);
matrix row_add();
matrix column_add();
matrix bubblesort();
void randindex();
double median();
matrix median_column();
//matrix strip_column(int n);
// int getnrow();
// int getncolumn();
};
#endif /* _MATRIX_H_ */