@@ -69,6 +69,8 @@ NumberFieldElement_quadratic = ()
6969AA = None
7070QQbar = None
7171CDF = CLF = RLF = None
72+
73+
7274def late_import ():
7375 """
7476 Import the objects/modules after build (when needed).
@@ -89,12 +91,14 @@ def late_import():
8991 from sage.rings.real_lazy import CLF, RLF
9092 from sage.rings.complex_double import CDF
9193
94+
9295cdef object numpy_complex_interface = {' typestr' : ' =c16' }
9396cdef object numpy_object_interface = {' typestr' : ' |O' }
9497
9598cdef mpfr_rnd_t rnd
9699rnd = MPFR_RNDN
97100
101+
98102def set_global_complex_round_mode (n ):
99103 """
100104 Set the global complex rounding mode.
@@ -111,6 +115,7 @@ def set_global_complex_round_mode(n):
111115 global rnd
112116 rnd = n
113117
118+
114119def is_ComplexNumber (x ):
115120 r """
116121 Return ``True`` if ``x`` is a complex number. In particular, if ``x`` is
@@ -145,6 +150,8 @@ def is_ComplexNumber(x):
145150
146151
147152cache = {}
153+
154+
148155def ComplexField (prec = 53 , names = None ):
149156 """
150157 Return the complex field with real and imaginary parts having prec
@@ -673,7 +680,6 @@ class ComplexField_class(sage.rings.abc.ComplexField):
673680 from sage.categories.pushout import AlgebraicClosureFunctor
674681 return (AlgebraicClosureFunctor(), self ._real_field())
675682
676-
677683 def random_element (self , component_max = 1 , *args , **kwds ):
678684 r """
679685 Return a uniformly distributed random number inside a square
@@ -857,6 +863,7 @@ class ComplexField_class(sage.rings.abc.ComplexField):
857863 return Factorization([(R(gg).monic(), e) for gg, e in zip (* F)],
858864 f.leading_coefficient())
859865
866+
860867cdef class ComplexNumber(sage.structure.element.FieldElement):
861868 """
862869 A floating point approximation to a complex number using any
@@ -1429,7 +1436,6 @@ cdef class ComplexNumber(sage.structure.element.FieldElement):
14291436 """
14301437 return gmpy2.GMPy_MPC_From_mpfr(self .__re, self .__im)
14311438
1432-
14331439 def _mpmath_ (self , prec = None , rounding = None ):
14341440 """
14351441 Return an mpmath version of ``self``.
@@ -2300,8 +2306,6 @@ cdef class ComplexNumber(sage.structure.element.FieldElement):
23002306 mpfr_clear(ch)
23012307 return z
23022308
2303-
2304-
23052309 def eta (self , omit_frac = False ):
23062310 r """
23072311 Return the value of the Dedekind `\e ta` function on ``self``,
@@ -2367,7 +2371,6 @@ cdef class ComplexNumber(sage.structure.element.FieldElement):
23672371 except sage.libs.pari.all.PariError:
23682372 raise ValueError (" value must be in the upper half plane" )
23692373
2370-
23712374 def sin (self ):
23722375 """
23732376 Return the sine of ``self``.
@@ -2461,7 +2464,6 @@ cdef class ComplexNumber(sage.structure.element.FieldElement):
24612464 mpfr_clear(a)
24622465 return z
24632466
2464-
24652467 def tanh (self ):
24662468 """
24672469 Return the hyperbolic tangent of ``self``.
@@ -2729,7 +2731,6 @@ cdef class ComplexNumber(sage.structure.element.FieldElement):
27292731 mpfr_atan2(x.value, self .__im, self .__re, rnd)
27302732 return x
27312733
2732-
27332734 def arg (self ):
27342735 """
27352736 See :meth:`argument`.
@@ -3080,7 +3081,6 @@ cdef class ComplexNumber(sage.structure.element.FieldElement):
30803081 mpfr_clear(r)
30813082 return zlist
30823083
3083-
30843084 def is_square (self ):
30853085 r """
30863086 This function always returns true as `\C C` is algebraically closed.
@@ -3498,6 +3498,7 @@ cpdef int cmp_abs(ComplexNumber a, ComplexNumber b) noexcept:
34983498
34993499 return res
35003500
3501+
35013502def _format_complex_number (real , imag , format_spec ):
35023503 """
35033504 Construct a formatted string from real and imaginary parts.
0 commit comments