|
17 | 17 | #ifndef INCLUDED_MEEVAX_KERNEL_COMPLEX_HPP
|
18 | 18 | #define INCLUDED_MEEVAX_KERNEL_COMPLEX_HPP
|
19 | 19 |
|
| 20 | +#include <complex> |
| 21 | +#include <regex> |
| 22 | + |
20 | 23 | #include <meevax/kernel/ghost.hpp>
|
21 | 24 | #include <meevax/kernel/pair.hpp>
|
22 | 25 |
|
23 | 26 | namespace meevax
|
24 | 27 | {
|
25 | 28 | inline namespace kernel
|
26 | 29 | {
|
27 |
| - struct complex : public number |
28 |
| - , public virtual pair |
| 30 | + struct complex : public virtual pair |
29 | 31 | {
|
30 | 32 | using pair::pair;
|
31 | 33 |
|
32 |
| - auto real() const noexcept -> const_reference; |
| 34 | + explicit complex(std::string const&, int = 10); |
33 | 35 |
|
34 |
| - auto real() noexcept -> reference; |
| 36 | + auto canonicalize() const -> value_type; |
35 | 37 |
|
36 | 38 | auto imag() const noexcept -> const_reference;
|
37 | 39 |
|
38 |
| - auto imag() noexcept -> reference; |
39 |
| - |
40 |
| - #define DEFINE(NAME) \ |
41 |
| - auto NAME() const -> value_type override \ |
42 |
| - { \ |
43 |
| - return unspecified; \ |
44 |
| - } \ |
45 |
| - static_assert(true) |
46 |
| - |
47 |
| - DEFINE(exact); DEFINE(inexact); |
48 |
| - |
49 |
| - DEFINE(sin); DEFINE(asin); DEFINE(sinh); DEFINE(asinh); DEFINE(exp); |
50 |
| - DEFINE(cos); DEFINE(acos); DEFINE(cosh); DEFINE(acosh); DEFINE(log); |
51 |
| - DEFINE(tan); DEFINE(atan); DEFINE(tanh); DEFINE(atanh); DEFINE(sqrt); |
52 |
| - |
53 |
| - DEFINE(floor); DEFINE(ceil); DEFINE(trunc); DEFINE(round); |
54 |
| - |
55 |
| - #undef DEFINE |
56 |
| - |
57 |
| - #define DEFINE(NAME) \ |
58 |
| - auto NAME(const_reference) const -> value_type override \ |
59 |
| - { \ |
60 |
| - return unspecified; \ |
61 |
| - } \ |
62 |
| - static_assert(true) |
63 |
| - |
64 |
| - DEFINE(atan2); |
65 |
| - DEFINE(pow); |
66 |
| - |
67 |
| - #undef DEFINE |
68 |
| - |
69 |
| - auto operator + (const_reference) const -> value_type override { return unspecified; } |
70 |
| - auto operator - (const_reference) const -> value_type override { return unspecified; } |
71 |
| - auto operator * (const_reference) const -> value_type override { return unspecified; } |
72 |
| - auto operator / (const_reference) const -> value_type override { return unspecified; } |
73 |
| - auto operator % (const_reference) const -> value_type override { return unspecified; } |
| 40 | + auto real() const noexcept -> const_reference; |
74 | 41 |
|
75 |
| - auto operator ==(const_reference) const -> bool override { return false; }; |
76 |
| - auto operator !=(const_reference) const -> bool override { return false; }; |
77 |
| - auto operator < (const_reference) const -> bool override { return false; }; |
78 |
| - auto operator <=(const_reference) const -> bool override { return false; }; |
79 |
| - auto operator > (const_reference) const -> bool override { return false; }; |
80 |
| - auto operator >=(const_reference) const -> bool override { return false; }; |
| 42 | + explicit operator std::complex<double>(); |
81 | 43 | };
|
82 | 44 |
|
83 | 45 | auto operator <<(std::ostream &, complex const&) -> std::ostream &;
|
|
0 commit comments