@@ -1850,10 +1850,7 @@ cdef class gr(flint_scalar):
1850
1850
return NotImplemented
1851
1851
1852
1852
def __pow__ (self , other ) -> gr:
1853
- if isinstance(other , int ):
1854
- return self ._pow_si(other)
1855
- else :
1856
- return NotImplemented
1853
+ return self.ctx.pow(self , other )
1857
1854
1858
1855
def is_square(self ):
1859
1856
""" Return whether the element is a square (may return ``None``).
@@ -1866,7 +1863,7 @@ cdef class gr(flint_scalar):
1866
1863
>>> Q(4).sqrt()
1867
1864
2
1868
1865
"""
1869
- return truth_to_py(self ._is_square( ))
1866
+ return truth_to_py(self .ctx.is_square( self ))
1870
1867
1871
1868
def sqrt (self ):
1872
1869
""" Return the square root of the element if it exists.
@@ -1875,7 +1872,7 @@ cdef class gr(flint_scalar):
1875
1872
>>> Z(4).sqrt()
1876
1873
2
1877
1874
"""
1878
- return self ._sqrt( )
1875
+ return self .ctx.sqrt( self )
1879
1876
1880
1877
def rsqrt (self ):
1881
1878
""" Return the reciprocal square root of the element if it exists.
@@ -1884,7 +1881,7 @@ cdef class gr(flint_scalar):
1884
1881
>>> Q(4).rsqrt()
1885
1882
1/2
1886
1883
"""
1887
- return self ._rsqrt( )
1884
+ return self .ctx.rsqrt( self )
1888
1885
1889
1886
def gcd (self , other ):
1890
1887
""" Return the greatest common divisor of two elements.
@@ -1914,7 +1911,7 @@ cdef class gr(flint_scalar):
1914
1911
other_gr = other
1915
1912
if not self .ctx == other_gr.ctx:
1916
1913
raise TypeError (" gcd of gr with different contexts." )
1917
- return self ._lcm( other_gr)
1914
+ return self .ctx.lcm( self , other_gr)
1918
1915
1919
1916
def factor (self ):
1920
1917
""" Return the factorization of the element.
@@ -1923,7 +1920,7 @@ cdef class gr(flint_scalar):
1923
1920
>>> Z(12).factor()
1924
1921
(1, [(2, 2), (3, 1)])
1925
1922
"""
1926
- return self ._factor( )
1923
+ return self .ctx.factor( self )
1927
1924
1928
1925
def numer (self ) -> gr:
1929
1926
"""Return the numerator of the element.
@@ -1937,7 +1934,7 @@ cdef class gr(flint_scalar):
1937
1934
1938
1935
See also :meth:`denom`.
1939
1936
"""
1940
- return self._numerator( )
1937
+ return self.ctx.numerator( self )
1941
1938
1942
1939
def denom(self ) -> gr:
1943
1940
"""Return the denominator of the element.
@@ -1951,21 +1948,21 @@ cdef class gr(flint_scalar):
1951
1948
1952
1949
See also :meth:`numer`.
1953
1950
"""
1954
- return self._denominator( )
1951
+ return self.ctx.denominator( self )
1955
1952
1956
1953
def __floor__(self ) -> gr:
1957
- return self._floor( )
1954
+ return self.ctx.floor( self )
1958
1955
1959
1956
def __ceil__(self ) -> gr:
1960
- return self._ceil( )
1957
+ return self.ctx.ceil( self )
1961
1958
1962
1959
def __trunc__(self ) -> gr:
1963
- return self._trunc( )
1960
+ return self.ctx.trunc( self )
1964
1961
1965
1962
def __round__(self , ndigits: int = 0 ) -> gr:
1966
1963
if ndigits != 0:
1967
1964
raise NotImplementedError("Rounding to a specific number of digits is not supported")
1968
- return self._nint( )
1965
+ return self.ctx.nint( self )
1969
1966
1970
1967
# def __int__(self ) -> int:
1971
1968
# return self._floor().to_int()
@@ -1974,7 +1971,7 @@ cdef class gr(flint_scalar):
1974
1971
# return ...
1975
1972
1976
1973
def __abs__(self ) -> gr:
1977
- return self._abs( )
1974
+ return self.ctx.abs( self )
1978
1975
1979
1976
def conjugate(self ) -> gr:
1980
1977
"""Return complex conjugate of the element.
@@ -1984,7 +1981,7 @@ cdef class gr(flint_scalar):
1984
1981
>>> (1 + I ).conjugate()
1985
1982
(1-I )
1986
1983
"""
1987
- return self._conj( )
1984
+ return self.ctx.conj( self )
1988
1985
1989
1986
@property
1990
1987
def real(self ) -> gr:
@@ -1995,7 +1992,7 @@ cdef class gr(flint_scalar):
1995
1992
>>> (1 + I ).real
1996
1993
1
1997
1994
"""
1998
- return self._re( )
1995
+ return self.ctx.re( self )
1999
1996
2000
1997
@property
2001
1998
def imag(self ) -> gr:
@@ -2006,7 +2003,7 @@ cdef class gr(flint_scalar):
2006
2003
>>> (1 + I ).imag
2007
2004
1
2008
2005
"""
2009
- return self._im( )
2006
+ return self.ctx.im( self )
2010
2007
2011
2008
# XXX: Return -1, 0, 1 as int?
2012
2009
def sgn(self ) -> gr:
@@ -2020,7 +2017,7 @@ cdef class gr(flint_scalar):
2020
2017
>>> Q(0).sgn()
2021
2018
0
2022
2019
"""
2023
- return self._sgn( )
2020
+ return self.ctx.sgn( self )
2024
2021
2025
2022
def csgn(self ) -> gr:
2026
2023
"""Return the complex sign of the element.
@@ -2030,7 +2027,7 @@ cdef class gr(flint_scalar):
2030
2027
>>> (1 + C.i()).csgn() # doctest: +SKIP
2031
2028
1
2032
2029
"""
2033
- return self._csgn( )
2030
+ return self.ctx.csgn( self )
2034
2031
2035
2032
def arg(self ) -> gr:
2036
2033
"""Return the argument of the element.
@@ -2040,4 +2037,4 @@ cdef class gr(flint_scalar):
2040
2037
>>> (1 + C.i()).arg()
2041
2038
[0.785 +/- 6.45e-4]
2042
2039
"""
2043
- return self._arg( )
2040
+ return self.ctx.arg( self )
0 commit comments