@@ -19,7 +19,7 @@ from flint.flintlib.functions.gr_domains cimport (
1919 gr_ctx_is_algebraically_closed,
2020 gr_ctx_is_finite_characteristic,
2121 gr_ctx_is_ordered_ring,
22- gr_ctx_is_zero_ring,
22+ # gr_ctx_is_zero_ring,
2323 gr_ctx_is_exact,
2424 gr_ctx_is_canonical,
2525 gr_ctx_has_real_prec,
@@ -165,10 +165,10 @@ cdef class gr_ctx(flint_ctx):
165165 """
166166 return truth_to_py(gr_ctx_is_ordered_ring(self.ctx_t ))
167167
168- @property
169- def is_zero_ring(self ) -> bool | None:
170- """True if the domain is a zero ring (can be ``None`` if unknown )."""
171- return truth_to_py(gr_ctx_is_zero_ring(self.ctx_t ))
168+ # @property
169+ # def is_zero_ring(self ) -> bool | None:
170+ # """True if the domain is a zero ring (can be ``None`` if unknown )."""
171+ # return truth_to_py(gr_ctx_is_zero_ring(self.ctx_t ))
172172
173173 @property
174174 def is_exact(self ) -> bool | None:
@@ -229,7 +229,10 @@ cdef class gr_ctx(flint_ctx):
229229 >>> ctx(2)
230230 2
231231 """
232- return self.from_str(str(arg ))
232+ try:
233+ return self.from_str(str(arg ))
234+ except AssertionError:
235+ return self.from_si(int(arg ))
233236
234237 def zero(self ) -> gr:
235238 """Return the zero element of the domain.
@@ -314,11 +317,11 @@ cdef class gr_ctx(flint_ctx):
314317 def gen(self ) -> gr:
315318 """Return the generator of the domain (if available ).
316319
317- >>> from flint.types._gr import gr_fmpzi_ctx , gr_fq_nmod_ctx
320+ >>> from flint.types._gr import gr_fmpzi_ctx , gr_fq_ctx
318321 >>> ctx = gr_fmpzi_ctx
319322 >>> ctx.gen()
320323 I
321- >>> ctx = gr_fq_nmod_ctx .new(5 , 2 )
324+ >>> ctx = gr_fq_ctx .new(5 , 2 )
322325 >>> ctx.gen()
323326 a
324327 """
@@ -327,23 +330,25 @@ cdef class gr_ctx(flint_ctx):
327330 def gens(self ) -> list[gr]:
328331 """Return the top-level generators of the domain
329332
330- >>> from flint.types._gr import gr_fmpzi_ctx , gr_gr_mpoly_ctx
331- >>> ctx = gr_gr_mpoly_ctx.new(gr_fmpzi_ctx, [' x' , ' y' ])
332- >>> ctx.gens()
333- [x , y]
334- >>> gr_fmpzi_ctx.gens()
335- [I]
336- >>> ctx.gens_recursive()
337- [I , x , y]
333+ # XXX: Does not work with FLINT < 3.1
334+
335+ # >>> from flint.types._gr import gr_fmpzi_ctx , gr_gr_mpoly_ctx
336+ # >>> ctx = gr_gr_mpoly_ctx.new(gr_fmpzi_ctx, [' x' , ' y' ])
337+ # >>> ctx.gens()
338+ # [x , y]
339+ # >>> gr_fmpzi_ctx.gens()
340+ # [I]
341+ # >>> ctx.gens_recursive()
342+ # [I , x , y]
338343 """
339344 return self._gens()
340345
341- def gens_recursive(self ) -> list[gr]:
342- """Return all generators of the domain
346+ # def gens_recursive(self ) -> list[gr]:
347+ # """Return all generators of the domain
343348
344- See :meth:`gens` for an example.
345- """
346- return self._gens_recursive()
349+ # See :meth:`gens` for an example.
350+ # """
351+ # return self._gens_recursive()
347352
348353
349354cdef class gr_scalar_ctx(gr_ctx ):
@@ -534,8 +539,6 @@ cdef class gr_fmpz_mod_ctx(gr_scalar_ctx):
534539 >>> Z64 = gr_fmpz_mod_ctx.new(2 ** 64 + 1 )
535540 >>> Z64
536541 gr_fmpz_mod_ctx(18446744073709551617)
537- >>> Z64(2**64+1)
538- 0
539542 >>> Z64(2)**64 + 2
540543 1
541544 >>> Z64.is_prime
@@ -625,21 +628,22 @@ cdef class gr_fq_nmod_ctx(gr_scalar_ctx):
625628 def new (p , d , name = None ) -> gr_fq_nmod_ctx:
626629 """Create a new context for finite fields.
627630
628- >>> from flint.types._gr import gr_fq_nmod_ctx
629- >>> F9 = gr_fq_nmod_ctx.new(3 , 2 )
630- >>> F9
631- gr_fq_nmod_ctx(3, 2)
632- >>> F9(2) + F9(3)
633- 2
634- >>> F9.characteristic()
635- 3
636- >>> F9.degree()
637- 2
638- >>> F9.gen()
639- a
640- >>> a = F9.gen()
641- >>> (1 + a ) ** 2 + a
642- a+2
631+ # XXX: Does not work with FLINT < 3.1
632+ # >>> from flint.types._gr import gr_fq_nmod_ctx
633+ # >>> F9 = gr_fq_nmod_ctx.new(3 , 2 )
634+ # >>> F9
635+ # gr_fq_nmod_ctx(3, 2)
636+ # >>> F9(2) + F9(3)
637+ # 2
638+ # >>> F9.characteristic()
639+ # 3
640+ # >>> F9.degree()
641+ # 2
642+ # >>> F9.gen()
643+ # a
644+ # >>> a = F9.gen()
645+ # >>> (1 + a ) ** 2 + a
646+ # a+2
643647 """
644648 cdef bytes name_b
645649 cdef char *name_c
@@ -677,21 +681,22 @@ cdef class gr_fq_zech_ctx(gr_scalar_ctx):
677681 def new (p , d , name = None ) -> gr_fq_zech_ctx:
678682 """Create a new context for finite fields with small characteristic.
679683
680- >>> from flint.types._gr import gr_fq_zech_ctx
681- >>> F9 = gr_fq_zech_ctx.new(3 , 2 )
682- >>> F9
683- gr_fq_zech_ctx(3, 2)
684- >>> F9(2) + F9(3) # XXX: Is this correct?
685- a^4
686- >>> F9.characteristic()
687- 3
688- >>> F9.degree()
689- 2
690- >>> F9.gen()
691- a^1
692- >>> a = F9.gen()
693- >>> (1 + a ) ** 2 + a # doctest: +SKIP
694- a+2
684+ # XXX: Does not work with FLINT < 3.1
685+ # >>> from flint.types._gr import gr_fq_zech_ctx
686+ # >>> F9 = gr_fq_zech_ctx.new(3 , 2 )
687+ # >>> F9
688+ # gr_fq_zech_ctx(3, 2)
689+ # >>> F9(2) + F9(3) # XXX: Is this correct?
690+ # a^4
691+ # >>> F9.characteristic()
692+ # 3
693+ # >>> F9.degree()
694+ # 2
695+ # >>> F9.gen()
696+ # a^1
697+ # >>> a = F9.gen()
698+ # >>> (1 + a ) ** 2 + a # doctest: +SKIP
699+ # a+2
695700 """
696701 cdef bytes name_b
697702 cdef char *name_c
@@ -1066,22 +1071,18 @@ cdef class gr_gr_poly_ctx(gr_poly_ctx):
10661071 def new (base_ring ) -> gr_gr_poly_ctx:
10671072 """Create a new context for dense univariate polynomial rings.
10681073
1069- >>> from flint.types._gr import gr_fmpzi_ctx , gr_gr_poly_ctx
1070- >>> ZI = gr_fmpzi_ctx
1071- >>> R = gr_gr_poly_ctx.new(ZI )
1074+ >>> from flint.types._gr import gr_fmpz_ctx , gr_gr_poly_ctx
1075+ >>> Z = gr_fmpz_ctx
1076+ >>> R = gr_gr_poly_ctx.new(Z )
10721077 >>> R
1073- gr_gr_poly_ctx(gr_fmpzi_ctx )
1078+ gr_gr_poly_ctx(gr_fmpz_ctx )
10741079 >>> R.base_ring
1075- gr_fmpzi_ctx
1080+ gr_fmpz_ctx
10761081 >>> R.gen()
10771082 x
1078- >>> ZI.gen()
1079- I
1080- >>> R.gens_recursive()
1081- [I , x]
1082- >>> I , x = R.gens_recursive()
1083- >>> (I + x ) ** 2
1084- -1 + (2*I )*x + x^2
1083+ >>> x = R.gen()
1084+ >>> (1 + x ) ** 2
1085+ 1 + 2*x + x^2
10851086 """
10861087 return gr_gr_poly_ctx._new(base_ring )
10871088
@@ -1101,26 +1102,24 @@ cdef class gr_gr_mpoly_ctx(gr_mpoly_ctx):
11011102 def new (base_ring , names , order = None ) -> gr_gr_mpoly_ctx:
11021103 """Create a new context for dense multivariate polynomial rings.
11031104
1104- >>> from flint.types._gr import gr_fmpzi_ctx , gr_gr_mpoly_ctx
1105- >>> ZI = gr_fmpzi_ctx
1106- >>> R = gr_gr_mpoly_ctx.new(ZI, [' x' , ' y' ])
1107- >>> R
1108- gr_gr_mpoly_ctx(gr_fmpzi_ctx , ('x', 'y'), Ordering.lex )
1109- >>> R.base_ring
1110- gr_fmpzi_ctx
1111- >>> R.names
1112- ('x', 'y')
1113- >>> R.nvars
1114- 2
1115- >>> R.order
1116- <Ordering.lex: 'lex'>
1117- >>> R.gens()
1118- [x , y]
1119- >>> R.gens_recursive()
1120- [I , x , y]
1121- >>> I , x , y = R.gens_recursive()
1122- >>> (I + x + y ) ** 2
1123- x^2 + 2*x*y + (2*I )*x + y^2 + (2*I )*y - 1
1105+ # >>> from flint.types._gr import gr_fmpzi_ctx , gr_gr_mpoly_ctx
1106+ # >>> ZI = gr_fmpzi_ctx
1107+ # >>> R = gr_gr_mpoly_ctx.new(ZI, [' x' , ' y' ])
1108+ # >>> R
1109+ # gr_gr_mpoly_ctx(gr_fmpzi_ctx , ('x', 'y'), Ordering.lex )
1110+ # >>> R.base_ring
1111+ # gr_fmpzi_ctx
1112+ # >>> R.names
1113+ # ('x', 'y')
1114+ # >>> R.nvars
1115+ # 2
1116+ # >>> R.order
1117+ # <Ordering.lex: 'lex'>
1118+ # >>> R.gens()
1119+ # [x , y]
1120+ # >>> I , [x , y] = ZI.gen(), R.gens()
1121+ # >>> (I + x + y ) ** 2
1122+ # x^2 + 2*x*y + (2*I )*x + y^2 + (2*I )*y - 1
11241123 """
11251124 if order is None:
11261125 order = Ordering.lex
@@ -1194,20 +1193,18 @@ cdef class gr_series_ctx(gr_ctx):
11941193 def new (base_ring , prec ) -> gr_series_ctx:
11951194 """Create a new context for series with precision `n`.
11961195
1197- >>> from flint.types._gr import gr_fmpzi_ctx , gr_series_ctx
1198- >>> ZI = gr_fmpzi_ctx
1199- >>> R = gr_series_ctx.new(ZI , 10 )
1196+ >>> from flint.types._gr import gr_fmpz_ctx , gr_series_ctx
1197+ >>> Z = gr_fmpz_ctx
1198+ >>> R = gr_series_ctx.new(Z , 10 )
12001199 >>> R
1201- gr_series_ctx(gr_fmpzi_ctx , 10)
1200+ gr_series_ctx(gr_fmpz_ctx , 10)
12021201 >>> R.base_ring
1203- gr_fmpzi_ctx
1202+ gr_fmpz_ctx
12041203 >>> R.prec
12051204 10
1206- >>> R.gens_recursive()
1207- [I , x]
1208- >>> I , x = R.gens_recursive()
1209- >>> 1 / (I - x )
1210- -I - x + I*x^2 + x^3 - I*x^4 - x^5 + I*x^6 + x^7 - I*x^8 - x^9 + O(x^10)
1205+ >>> x = R.gen()
1206+ >>> 1 / (1 - x )
1207+ 1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9 + O(x^10)
12111208 """
12121209 return gr_series_ctx._new(base_ring , prec )
12131210
@@ -1589,7 +1586,7 @@ cdef class gr(flint_scalar):
15891586
15901587 >>> from flint.types._gr import gr_complex_acb_ctx
15911588 >>> C = gr_complex_acb_ctx.new(10 )
1592- >>> (1 + C.i()).csgn()
1589+ >>> (1 + C.i()).csgn() # doctest: + SKIP
15931590 1
15941591 """
15951592 return self._csgn()
0 commit comments