-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpoly.cpp
53 lines (44 loc) · 1.36 KB
/
poly.cpp
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
#pragma once
#include "poly.h"
inline polynomial operator * (polynomial lhs, const polynomial &rhs) {
return lhs *= rhs;
}
inline polynomial operator * (polynomial lhs, const cmplx &rhs) {
return lhs *= rhs;
}
inline polynomial operator * (const cmplx &rhs, polynomial lhs) {
return lhs *= rhs;
}
inline polynomial operator + (polynomial lhs, const polynomial &rhs) {
return lhs += rhs;
}
inline polynomial operator + (polynomial lhs, const cmplx &rhs) {
return lhs += rhs;
}
inline polynomial operator + (const cmplx &rhs, polynomial lhs) {
return lhs += rhs;
}
inline polynomial operator - (polynomial lhs, const polynomial &rhs) {
return lhs -= rhs;
}
inline polynomial operator - (polynomial lhs, const cmplx &rhs) {
return lhs -= rhs;
}
inline polynomial operator - (const cmplx &rhs, polynomial lhs) {
return lhs -= rhs;
}
inline polynomial operator / (polynomial lhs, const polynomial &rhs) {
return lhs /= rhs;
}
inline polynomial operator / (polynomial lhs, const cmplx &rhs) {
return lhs /= rhs;
}
inline polynomial operator / (const cmplx &rhs, polynomial lhs) {
return lhs /= rhs;
}
inline bool operator==(const polynomial& lhs, const polynomial& rhs) {
return lhs.get_poly() == rhs.get_poly();
}
inline bool operator!=(const polynomial& lhs, const polynomial& rhs) {
return !operator==(lhs, rhs);
}