-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathMatrix.h
44 lines (41 loc) · 1.13 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
#ifndef MATRIX_H
#define MATRIX_H
#include <cstddef>
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
using namespace std;
class Matrix
{
public:
Matrix();
Matrix(int r, int c);
Matrix(int r, int c, double* data);
virtual ~Matrix();
Matrix(const Matrix& other);
Matrix& operator=(const Matrix& other);
Matrix operator+(const Matrix& val);
Matrix operator+(const double val);
Matrix operator-(const Matrix& val);
Matrix operator*(const Matrix& val);
int Getrows() const{ return m_rows; }
int Getcolumns() const{ return m_columns; }
double* Getdata() { return m_data; }
double Get(int r, int c) const;
void Set(int r, int c, double val);
void DisplayMtr();
Matrix InverseMtr();
Matrix TransposeMtr();
void Empty();
protected:
private:
int m_rows;
int m_columns;
double* m_data;
void inv(double *a,int n);
void Setdata(double* val, int len);
void ResizeMtr(int r, int c);
void ClearMtr();
};
#endif // MATRIX_H