-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMatrix.h
41 lines (32 loc) · 1.22 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
#ifndef JMG_MATRIX_H
#define JMG_MATRIX_H
#include <string>
#include <iostream>
#include <complex>
using std::complex;
struct Matrix
{
public:
static const Matrix identity_matrix;
Matrix()
: a(0.0), b(0.0), c(0.0), d(0.0) {}
Matrix(const complex <double> & A, const complex <double> & B, const complex <double> & C, const complex <double> & D)
: a(A), b(B), c(C), d(D) {}
Matrix Inverted() const;
complex <double> CalculateDeterminant() const;
std::string ToString() const;
complex <double> a, b, c, d;
private:
static std::string ComplexToString(const complex <double> & value);
};
Matrix operator + (const Matrix & lhs, const Matrix & rhs);
Matrix operator - (const Matrix & lhs, const Matrix & rhs);
Matrix operator * (const Matrix & lhs, const Matrix & rhs);
Matrix operator * (const Matrix & lhs, const complex <double> & rhs);
Matrix operator * (const complex <double> &lhs, const Matrix & rhs);
Matrix operator / (const Matrix & lhs, const complex <double> & rhs);
Matrix operator - (const Matrix & rhs);
std::ostream & operator << (std::ostream & lhs, const Matrix & rhs);
bool operator == (const Matrix & lhs, const Matrix & rhs);
bool operator != (const Matrix & lhs, const Matrix & rhs);
#endif