-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmatrix.hpp
49 lines (45 loc) · 1.24 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
#ifndef MATRIX_HPP
#define MATRIX_HPP
namespace caams
{
enum matrix_flags{
uninitialized = 0,
init = 1,
identity = 2,
init_identity = 3,
zeros = 1
};
struct matrix
{
public:
long rows;
long cols;
double *data;
public:
matrix(long n_rows, long n_cols, matrix_flags flags=uninitialized);
matrix(long n_rows, long n_cols, double a11, ... );
matrix(long n_rows, long n_cols, double *src);
matrix(matrix const & m);
~matrix( void );
matrix & operator=(matrix const & m);
matrix & operator+=(matrix const & m);
matrix & operator-=(matrix const & m);
matrix & operator*=(matrix const & m);
matrix operator~(void);
long n_rows(void);
long n_cols(void);
matrix inverse(void);
void sub(matrix const & m, long row, long col);
void sub(double s, long row, long col);
matrix sub(long nrows, long ncols, long row, long col);
void print(const char *name);
};
matrix operator+(matrix const & m);
matrix operator-(matrix const & m);
matrix operator+(matrix const & m1, matrix const & m2);
matrix operator-(matrix const & m1, matrix const & m2);
matrix operator*(matrix const & m1, matrix const & m2);
matrix operator*(double const &s, matrix const & m);
matrix operator*(matrix const & m, double const &s);
}
#endif