-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMatrix.hpp
193 lines (136 loc) · 5.75 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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#pragma once
// #include <string>
#include "BigInteger.hpp"
// using std::istream;
// using std::ostream;
// using std::string;
// typedef unsigned char uc;
// typedef unsigned int ui;
// typedef long long ll;
// typedef long double ld;
class MatrixLD
{
private:
uc M;
uc N;
ld *Array;
public:
MatrixLD();
MatrixLD(const uc, const uc, ld *);
MatrixLD(const uc, const uc, const string *);
MatrixLD(const MatrixLD &);
MatrixLD(MatrixLD &&) noexcept;
~MatrixLD();
MatrixLD Add(const MatrixLD &) const;
MatrixLD Subtract(const MatrixLD &) const;
MatrixLD Multiply(const MatrixLD &) const;
// Getters & Setters
const uc GetM() const;
const uc GetN() const;
const ld *GetArray() const;
const ld operator[](const unsigned short &) const;
friend MatrixLD operator+(const MatrixLD &, const MatrixLD &);
friend MatrixLD operator+(const MatrixLD &, const ld &);
friend MatrixLD operator-(const MatrixLD &, const MatrixLD &);
friend MatrixLD operator-(const MatrixLD &, const ld &);
friend MatrixLD operator*(const MatrixLD &, const MatrixLD &);
friend MatrixLD operator*(const MatrixLD &, const ld &);
// MatrixLD operator^(MatrixLD &);
friend bool operator==(const MatrixLD &, const MatrixLD &);
friend bool operator!=(const MatrixLD &, const MatrixLD &);
MatrixLD &operator=(const MatrixLD &);
MatrixLD &operator=(MatrixLD &&) noexcept;
friend MatrixLD &operator+=(MatrixLD &, const MatrixLD &);
friend MatrixLD &operator+=(MatrixLD &, const ld &);
friend MatrixLD &operator-=(MatrixLD &, const MatrixLD &);
friend MatrixLD &operator-=(MatrixLD &, const ld &);
friend MatrixLD &operator*=(MatrixLD &, const MatrixLD &);
friend MatrixLD &operator*=(MatrixLD &, const ld &);
// MatrixLD &operator^=(MatrixLD &);
// OutStream
friend ostream &operator<<(ostream &, const MatrixLD &);
};
class MatrixLL
{
private:
uc M;
uc N;
ll *Array;
public:
MatrixLL();
MatrixLL(const uc, const uc, ll *);
MatrixLL(const uc, const uc, string *);
MatrixLL(const MatrixLL &);
MatrixLL(MatrixLL &&) noexcept;
~MatrixLL();
MatrixLL Add(const MatrixLL &) const;
MatrixLL Subtract(const MatrixLL &) const;
MatrixLL Multiply(const MatrixLL &) const;
// Getters & Setters
const uc GetM() const;
const uc GetN() const;
const ll *GetArray() const;
const ll operator[](const unsigned short &) const;
friend MatrixLL operator+(const MatrixLL &, const MatrixLL &);
friend MatrixLL operator+(const MatrixLL &, const ll &);
friend MatrixLL operator-(const MatrixLL &, const MatrixLL &);
friend MatrixLL operator-(const MatrixLL &, const ll &);
friend MatrixLL operator*(const MatrixLL &, const MatrixLL &);
friend MatrixLL operator*(const MatrixLL &, const ll &);
// MatrixLL operator^(MatrixLL &);
friend bool operator==(const MatrixLL &, const MatrixLL &);
friend bool operator!=(const MatrixLL &, const MatrixLL &);
MatrixLL &operator=(const MatrixLL &);
MatrixLL &operator=(MatrixLL &&) noexcept;
friend MatrixLL &operator+=(MatrixLL &, const MatrixLL &);
friend MatrixLL &operator+=(MatrixLL &, const ll &);
friend MatrixLL &operator-=(MatrixLL &, const MatrixLL &);
friend MatrixLL &operator-=(MatrixLL &, const ll &);
friend MatrixLL &operator*=(MatrixLL &, const MatrixLL &);
friend MatrixLL &operator*=(MatrixLL &, const ll &);
// MatrixLL &operator^=(MatrixLL &);
// OutStream
friend ostream &operator<<(ostream &, const MatrixLL &);
};
class MatrixBigInteger
{
private:
uc M;
uc N;
BigInteger *Array;
public:
MatrixBigInteger();
MatrixBigInteger(const uc, const uc, BigInteger *);
MatrixBigInteger(const uc, const uc, const string *);
MatrixBigInteger(const MatrixBigInteger &);
MatrixBigInteger(MatrixBigInteger &&) noexcept;
~MatrixBigInteger();
MatrixBigInteger Add(const MatrixBigInteger &) const;
MatrixBigInteger Subtract(const MatrixBigInteger &) const;
MatrixBigInteger Multiply(const MatrixBigInteger &) const;
// Getters & Setters
const uc GetM() const;
const uc GetN() const;
const BigInteger *GetArray() const;
const BigInteger operator[](const unsigned short &) const;
friend MatrixBigInteger operator+(const MatrixBigInteger &, const MatrixBigInteger &);
friend MatrixBigInteger operator+(const MatrixBigInteger &, const BigInteger &);
friend MatrixBigInteger operator-(const MatrixBigInteger &, const MatrixBigInteger &);
friend MatrixBigInteger operator-(const MatrixBigInteger &, const BigInteger &);
friend MatrixBigInteger operator*(const MatrixBigInteger &, const MatrixBigInteger &);
friend MatrixBigInteger operator*(const MatrixBigInteger &, const BigInteger &);
// MatrixBigInteger operator^(MatrixBigInteger &);
friend bool operator==(const MatrixBigInteger &, const MatrixBigInteger &);
friend bool operator!=(const MatrixBigInteger &, const MatrixBigInteger &);
MatrixBigInteger &operator=(const MatrixBigInteger &);
MatrixBigInteger &operator=(MatrixBigInteger &&) noexcept;
friend MatrixBigInteger &operator+=(MatrixBigInteger &, const MatrixBigInteger &);
friend MatrixBigInteger &operator+=(MatrixBigInteger &, const BigInteger &);
friend MatrixBigInteger &operator-=(MatrixBigInteger &, const MatrixBigInteger &);
friend MatrixBigInteger &operator-=(MatrixBigInteger &, const BigInteger &);
friend MatrixBigInteger &operator*=(MatrixBigInteger &, const MatrixBigInteger &);
friend MatrixBigInteger &operator*=(MatrixBigInteger &, const BigInteger &);
// MatrixBigInteger &operator^=(MatrixBigInteger &);
// OutStream
friend ostream &operator<<(ostream &, const MatrixBigInteger &);
};