Skip to content

Commit 117880c

Browse files
committed
rename __prec -> _prec
1 parent dedfbf7 commit 117880c

File tree

8 files changed

+87
-87
lines changed

8 files changed

+87
-87
lines changed

src/sage/numerical/gauss_legendre.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ def nodes_uncached(degree, prec):
117117
raise ValueError("degree=%s not supported (degree must be 3 or even)" % degree)
118118
R = RealField(int(prec*3/2))
119119
Rout = RealField(prec)
120-
mpfr_init2(u,R.__prec)
121-
mpfr_init2(v,R.__prec)
120+
mpfr_init2(u,R._prec)
121+
mpfr_init2(v,R._prec)
122122
ZERO = R.zero()
123123
ONE = R.one()
124124
HALF = ONE/2

src/sage/rings/complex_mpc.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement):
1111
cpdef _mul_(self, other)
1212

1313
cdef class MPComplexField_class(sage.rings.ring.Field):
14-
cdef readonly int __prec
14+
cdef readonly int _prec
1515
cdef mpc_rnd_t __rnd
1616
cdef object __rnd_str
1717
cdef object __real_field

src/sage/rings/complex_mpc.pyx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ cdef class MPComplexField_class(sage.rings.ring.Field):
307307
if prec < mpfr_prec_min() or prec > mpfr_prec_max():
308308
raise ValueError("prec (=%s) must be >= %s and <= %s." % (
309309
prec, mpfr_prec_min(), mpfr_prec_max()))
310-
self.__prec = prec
310+
self._prec = prec
311311
if not isinstance(rnd, str):
312312
raise TypeError("rnd must be a string")
313313
try:
@@ -331,7 +331,7 @@ cdef class MPComplexField_class(sage.rings.ring.Field):
331331
cdef MPComplexNumber z
332332
z = MPComplexNumber.__new__(MPComplexNumber)
333333
z._parent = self
334-
mpc_init2(z.value, self.__prec)
334+
mpc_init2(z.value, self._prec)
335335
z.init = 1
336336
return z
337337

@@ -344,7 +344,7 @@ cdef class MPComplexField_class(sage.rings.ring.Field):
344344
sage: MPComplexField(200, 'RNDDU') # indirect doctest
345345
Complex Field with 200 bits of precision and rounding RNDDU
346346
"""
347-
s = "Complex Field with %s bits of precision"%self.__prec
347+
s = "Complex Field with %s bits of precision"%self._prec
348348
if self.__rnd != MPC_RNDNN:
349349
s = s + " and rounding %s"%(self.__rnd_str)
350350
return s
@@ -465,13 +465,13 @@ cdef class MPComplexField_class(sage.rings.ring.Field):
465465
if RR.has_coerce_map_from(S):
466466
return self._coerce_map_via([RR], S)
467467

468-
if isinstance(S, MPComplexField_class) and S.prec() >= self.__prec:
468+
if isinstance(S, MPComplexField_class) and S.prec() >= self._prec:
469469
#FIXME: What map when rounding modes differ but prec is the same ?
470470
# How to provide commutativity of morphisms ?
471471
# Change _cmp_ when done
472472
return MPCtoMPC(S, self)
473473

474-
if isinstance(S, ComplexField_class) and S.prec() >= self.__prec:
474+
if isinstance(S, ComplexField_class) and S.prec() >= self._prec:
475475
return CCtoMPC(S, self)
476476

477477
late_import()
@@ -490,7 +490,7 @@ cdef class MPComplexField_class(sage.rings.ring.Field):
490490
sage: loads(dumps(C)) == C
491491
True
492492
"""
493-
return __create__MPComplexField_version0, (self.__prec, self.__rnd_str)
493+
return __create__MPComplexField_version0, (self._prec, self.__rnd_str)
494494

495495
def __richcmp__(left, right, int op):
496496
"""
@@ -513,7 +513,7 @@ cdef class MPComplexField_class(sage.rings.ring.Field):
513513

514514
cdef MPComplexField_class s = <MPComplexField_class>left
515515
cdef MPComplexField_class o = <MPComplexField_class>right
516-
return richcmp(s.__prec, o.__prec, op)
516+
return richcmp(s._prec, o._prec, op)
517517

518518
def gen(self, n=0):
519519
"""
@@ -604,7 +604,7 @@ cdef class MPComplexField_class(sage.rings.ring.Field):
604604
sage: C = MPComplexField(10, 'RNDNZ'); C.name()
605605
'MPComplexField10_RNDNZ'
606606
"""
607-
return "MPComplexField%s_%s"%(self.__prec, self.__rnd_str)
607+
return "MPComplexField%s_%s"%(self._prec, self.__rnd_str)
608608

609609
def __hash__(self):
610610
"""
@@ -629,7 +629,7 @@ cdef class MPComplexField_class(sage.rings.ring.Field):
629629
sage: MPComplexField(22).prec()
630630
22
631631
"""
632-
return self.__prec
632+
return self._prec
633633

634634
def rounding_mode(self):
635635
"""
@@ -707,7 +707,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement):
707707
cdef MPComplexNumber z
708708
z = MPComplexNumber.__new__(MPComplexNumber)
709709
z._parent = self._parent
710-
mpc_init2(z.value, (<MPComplexField_class>self._parent).__prec)
710+
mpc_init2(z.value, (<MPComplexField_class>self._parent)._prec)
711711
z.init = 1
712712
return z
713713

@@ -760,7 +760,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement):
760760
if parent is None:
761761
raise TypeError
762762
self._parent = parent
763-
mpc_init2(self.value, parent.__prec)
763+
mpc_init2(self.value, parent._prec)
764764
self.init = 1
765765
if x is None: return
766766
self._set(x, y, base)
@@ -1010,7 +1010,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement):
10101010
sage: i.prec()
10111011
2000
10121012
"""
1013-
return <MPComplexField_class>(self._parent).__prec
1013+
return <MPComplexField_class>(self._parent)._prec
10141014

10151015
def real(self):
10161016
"""
@@ -2347,7 +2347,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement):
23472347

23482348
cdef mpc_rnd_t rnd = (<MPComplexField_class>(self._parent)).__rnd
23492349

2350-
cdef int prec = self._parent.__prec
2350+
cdef int prec = self._parent._prec
23512351

23522352
if optimal or algorithm == "principal":
23532353
if not isinstance(right, MPComplexNumber) or (<MPComplexNumber>right)._parent is not self._parent:

src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ cdef class PolynomialRealDense(Polynomial):
116116
Polynomial.__init__(self, parent, is_gen=is_gen)
117117
self._base_ring = parent._base
118118
cdef Py_ssize_t i, degree
119-
cdef int prec = self._base_ring.__prec
119+
cdef int prec = self._base_ring._prec
120120
cdef mpfr_rnd_t rnd = self._base_ring.rnd
121121
if x is None:
122122
self._coeffs = <mpfr_t*>check_allocarray(1, sizeof(mpfr_t)) # degree zero
@@ -227,7 +227,7 @@ cdef class PolynomialRealDense(Polynomial):
227227

228228
cdef PolynomialRealDense _new(self, Py_ssize_t degree):
229229
cdef Py_ssize_t i
230-
cdef int prec = self._base_ring.__prec
230+
cdef int prec = self._base_ring._prec
231231
cdef PolynomialRealDense f = <PolynomialRealDense>PolynomialRealDense.__new__(PolynomialRealDense)
232232
f._parent = self._parent
233233
f._base_ring = self._base_ring
@@ -501,7 +501,7 @@ cdef class PolynomialRealDense(Polynomial):
501501
else:
502502
f = left._new(left._degree + right._degree)
503503
sig_on()
504-
mpfr_init2(tmp, left._base_ring.__prec)
504+
mpfr_init2(tmp, left._base_ring._prec)
505505
for i from 0 <= i <= f._degree:
506506
# Yes, we could make this more efficient by initializing with
507507
# a multiple of left rather than all zeros...
@@ -661,7 +661,7 @@ cdef class PolynomialRealDense(Polynomial):
661661
q = self._new(self._degree - other._degree)
662662
# This is the standard division algorithm
663663
sig_on()
664-
mpfr_init2(tmp, self._base_ring.__prec)
664+
mpfr_init2(tmp, self._base_ring._prec)
665665
for i from self._degree >= i >= other._degree:
666666
mpfr_set(q._coeffs[i-other._degree], r._coeffs[i], rnd)
667667
for j from 0 <= j < other._degree:
@@ -725,7 +725,7 @@ cdef class PolynomialRealDense(Polynomial):
725725
cdef RealNumber x = <RealNumber>xx
726726
cdef RealNumber res
727727

728-
if (<RealField_class>x._parent).__prec < self._base_ring.__prec:
728+
if (<RealField_class>x._parent)._prec < self._base_ring._prec:
729729
res = RealNumber(x._parent)
730730
else:
731731
res = RealNumber(self._base_ring)

src/sage/rings/real_mpfi.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ from .real_mpfr cimport RealField_class
1111
cdef class RealIntervalFieldElement(RingElement) # forward decl
1212

1313
cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField):
14-
cdef mpfr_prec_t __prec
14+
cdef mpfr_prec_t _prec
1515
cdef bint sci_not
1616
# Cache RealField instances for the lower, upper, and middle bounds.
1717
# These have the same precision as the interval field;

src/sage/rings/real_mpfi.pyx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField):
526526
if prec < MPFR_PREC_MIN or prec > MPFR_PREC_MAX:
527527
raise ValueError("prec (=%s) must be >= %s and <= %s." % (
528528
prec, MPFR_PREC_MIN, MPFR_PREC_MAX))
529-
self.__prec = prec
529+
self._prec = prec
530530
self.sci_not = sci_not
531531
self.__lower_field = RealField(prec, sci_not, "RNDD")
532532
self.__middle_field = RealField(prec, sci_not, "RNDN")
@@ -598,7 +598,7 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField):
598598
elif rnd == "RNDU":
599599
return self.upper_field()
600600
else:
601-
return RealField(self.__prec, self.sci_not, rnd)
601+
return RealField(self._prec, self.sci_not, rnd)
602602

603603
def _repr_(self):
604604
"""
@@ -611,7 +611,7 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField):
611611
sage: RealIntervalField(200) # indirect doctest
612612
Real Interval Field with 200 bits of precision
613613
"""
614-
s = "Real Interval Field with %s bits of precision"%self.__prec
614+
s = "Real Interval Field with %s bits of precision"%self._prec
615615
return s
616616

617617
def _latex_(self):
@@ -802,15 +802,15 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField):
802802
sage: RIF.has_coerce_map_from(float)
803803
False
804804
"""
805-
prec = self.__prec
805+
prec = self._prec
806806

807807
# Direct and efficient conversions
808808
if S is ZZ or S is QQ:
809809
return True
810810
if S is int or S is long:
811811
return True
812812
if isinstance(S, RealIntervalField_class):
813-
return (<RealIntervalField_class>S).__prec >= prec
813+
return (<RealIntervalField_class>S)._prec >= prec
814814
if isinstance(S, sage.rings.abc.NumberField_quadratic):
815815
return S.discriminant() > 0
816816

@@ -844,7 +844,7 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField):
844844
cdef RealIntervalField_class right
845845
left = self
846846
right = other # to access C structure
847-
return richcmp(left.__prec, right.__prec, op)
847+
return richcmp(left._prec, right._prec, op)
848848

849849
def __reduce__(self):
850850
"""
@@ -856,7 +856,7 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField):
856856
sage: loads(dumps(R)) == R
857857
True
858858
"""
859-
return __create__RealIntervalField_version0, (self.__prec, self.sci_not)
859+
return __create__RealIntervalField_version0, (self._prec, self.sci_not)
860860

861861
def random_element(self, *args, **kwds):
862862
"""
@@ -997,7 +997,7 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField):
997997
sage: RealIntervalField(200).name()
998998
'IntervalRealIntervalField200'
999999
"""
1000-
return "IntervalRealIntervalField%s"%(self.__prec)
1000+
return "IntervalRealIntervalField%s"%(self._prec)
10011001

10021002
def __hash__(self):
10031003
"""
@@ -1023,7 +1023,7 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField):
10231023
sage: RealIntervalField(200).precision()
10241024
200
10251025
"""
1026-
return self.__prec
1026+
return self._prec
10271027

10281028
prec = precision
10291029

@@ -1187,7 +1187,7 @@ cdef class RealIntervalFieldElement(RingElement):
11871187
sage: TestSuite(x).run(skip=["_test_eq", "_test_pickling"])
11881188
"""
11891189
cdef RealIntervalField_class p = <RealIntervalField_class?>parent
1190-
mpfi_init2(self.value, p.__prec)
1190+
mpfi_init2(self.value, p._prec)
11911191
self._parent = p
11921192

11931193
def __init__(self, parent, x, int base=10):
@@ -1864,7 +1864,7 @@ cdef class RealIntervalFieldElement(RingElement):
18641864

18651865
cdef mp_exp_t self_exp
18661866
cdef mpz_t self_zz
1867-
cdef mpfr_prec_t prec = (<RealIntervalField_class>self._parent).__prec
1867+
cdef mpfr_prec_t prec = (<RealIntervalField_class>self._parent)._prec
18681868
cdef char *zz_str
18691869
cdef size_t zz_str_maxlen
18701870

@@ -2977,7 +2977,7 @@ cdef class RealIntervalFieldElement(RingElement):
29772977
sage: RealIntervalField(200)(2.1).precision()
29782978
200
29792979
"""
2980-
return (<RealIntervalField_class>self._parent).__prec
2980+
return (<RealIntervalField_class>self._parent)._prec
29812981

29822982
prec = precision
29832983

src/sage/rings/real_mpfr.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ from sage.libs.mpfr.types cimport mpfr_prec_t
99
cdef class RealNumber(sage.structure.element.RingElement) # forward decl
1010

1111
cdef class RealField_class(sage.rings.abc.RealField):
12-
cdef mpfr_prec_t __prec
12+
cdef mpfr_prec_t _prec
1313
cdef bint sci_not
1414
cdef mpfr_rnd_t rnd
1515
cdef object rnd_str

0 commit comments

Comments
 (0)