File indexing completed on 2026-05-19 08:08:30
0001
0002
0003 #ifndef _CL_COMPLEX_H
0004 #define _CL_COMPLEX_H
0005
0006 #include "cln/number.h"
0007 #include "cln/complex_class.h"
0008 #include "cln/real_class.h"
0009 #include "cln/integer_class.h"
0010
0011 namespace cln {
0012
0013 CL_DEFINE_AS_CONVERSION(cl_N)
0014
0015
0016
0017 extern bool zerop (const cl_N& x);
0018
0019
0020
0021
0022 extern const cl_N complex (const cl_R& a, const cl_R& b);
0023
0024
0025 extern const cl_R realpart (const cl_N& x);
0026
0027
0028 extern const cl_R imagpart (const cl_N& x);
0029
0030
0031 extern const cl_N conjugate (const cl_N& x);
0032
0033
0034
0035 extern const cl_N operator- (const cl_N& x);
0036
0037
0038 extern const cl_N operator+ (const cl_N& x, const cl_N& y);
0039
0040
0041 extern const cl_N operator- (const cl_N& x, const cl_N& y);
0042
0043
0044 extern const cl_N operator* (const cl_N& x, const cl_N& y);
0045
0046
0047 extern const cl_N square (const cl_N& x);
0048
0049
0050 extern const cl_N operator/ (const cl_N& x, const cl_N& y);
0051
0052
0053 extern const cl_R abs (const cl_N& x);
0054
0055
0056 extern const cl_N recip (const cl_N& x);
0057
0058
0059 extern const cl_N plus1 (const cl_N& x);
0060
0061
0062 extern const cl_N minus1 (const cl_N& x);
0063
0064
0065 extern const cl_N signum (const cl_N& x);
0066
0067
0068 extern const cl_N sqrt (const cl_N& x);
0069
0070
0071 extern bool equal (const cl_N& x, const cl_N& y);
0072
0073 extern uint32 equal_hashcode (const cl_N& x);
0074
0075 inline bool operator== (const cl_N& x, const cl_N& y)
0076 { return equal(x,y); }
0077 inline bool operator!= (const cl_N& x, const cl_N& y)
0078 { return !equal(x,y); }
0079
0080
0081
0082 extern const cl_R phase (const cl_N& x);
0083
0084
0085 extern const cl_N exp (const cl_N& x);
0086
0087
0088 extern const cl_N log (const cl_N& x);
0089
0090
0091 extern const cl_N log (const cl_N& a, const cl_N& b);
0092
0093
0094 extern const cl_N expt (const cl_N& x, sintL y);
0095 extern const cl_N expt (const cl_N& x, const cl_I& y);
0096
0097
0098 extern const cl_N expt (const cl_N& x, const cl_N& y);
0099
0100
0101 extern const cl_N sin (const cl_N& x);
0102
0103
0104 extern const cl_N cos (const cl_N& x);
0105
0106
0107 extern const cl_N tan (const cl_N& x);
0108
0109
0110 extern const cl_N cis (const cl_R& x);
0111 extern const cl_N cis (const cl_N& x);
0112
0113
0114 extern const cl_N sinh (const cl_N& x);
0115
0116
0117 extern const cl_N cosh (const cl_N& x);
0118
0119
0120 extern const cl_N tanh (const cl_N& x);
0121
0122
0123 extern const cl_N atan (const cl_N& z);
0124
0125
0126 extern const cl_N atanh (const cl_N& z);
0127
0128
0129 extern const cl_N asin (const cl_N& z);
0130
0131
0132 extern const cl_N asinh (const cl_N& z);
0133
0134
0135 extern const cl_N acos (const cl_N& z);
0136
0137
0138 extern const cl_N acosh (const cl_N& z);
0139
0140
0141
0142 inline cl_N& operator+= (cl_N& x, const cl_N& y) { return x = x + y; }
0143 inline cl_N& operator++ (cl_N& x) { return x = plus1(x); }
0144 inline void operator++ (cl_N& x, int dummy) { (void)dummy; x = plus1(x); }
0145 inline cl_N& operator-= (cl_N& x, const cl_N& y) { return x = x - y; }
0146 inline cl_N& operator-- (cl_N& x) { return x = minus1(x); }
0147 inline void operator-- (cl_N& x, int dummy) { (void)dummy; x = minus1(x); }
0148 inline cl_N& operator*= (cl_N& x, const cl_N& y) { return x = x * y; }
0149 inline cl_N& operator/= (cl_N& x, const cl_N& y) { return x = x / y; }
0150
0151
0152
0153 extern cl_class cl_class_complex;
0154
0155 }
0156
0157 #endif