forked from Whirligig231/number-field-factorization
-
Notifications
You must be signed in to change notification settings - Fork 0
/
complex.h
executable file
·59 lines (45 loc) · 1.43 KB
/
complex.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <gmp.h>
#include <gmpxx.h>
#include <vector>
#include <functional>
#include <initializer_list>
#include <iostream>
#include "numbers.h"
#pragma once
class complex {
private:
mpf_class real, imag;
public:
complex();
complex(int real);
complex(mpf_class real);
complex(mpf_class real, mpf_class imag);
complex(const complex &other);
mpf_class get_real() const;
mpf_class get_imag() const;
complex &operator=(mpf_class value);
complex &operator=(const complex &other);
bool operator==(const complex &other) const;
bool operator!=(const complex &other) const;
complex &operator+=(const complex &other);
complex &operator-=(const complex &other);
complex &operator*=(const complex &other);
complex &operator/=(const complex &other);
complex operator+(const complex &other) const;
complex operator-(const complex &other) const;
complex operator*(const complex &other) const;
complex operator/(const complex &other) const;
complex operator-() const;
complex inv() const;
complex conjugate() const;
mpf_class norm() const;
friend std::ostream &operator<<(std::ostream &os, const complex &p);
};
template <>
class util<complex> {
public:
static complex zero();
static complex zero(const complex &reference);
static complex one(const complex &reference);
static complex from_int(int n, const complex &reference);
};