11#
22#
33#
4- from typing import Generic , TypeVar , Iterator , Iterable , Any , Final , Self , Mapping , Sequence
4+ from typing import (
5+ Generic ,
6+ TypeVar ,
7+ Iterator ,
8+ Iterable ,
9+ Any ,
10+ Final ,
11+ Self ,
12+ Mapping ,
13+ Sequence ,
14+ overload ,
15+ )
516from abc import abstractmethod
617import enum
718
8-
919FLINT_VERSION : Final [str ]
1020FLINT_RELEASE : Final [int ]
1121
22+ Telem = TypeVar ("Telem" , bound = flint_scalar )
23+ Telem_coerce = TypeVar ("Telem_coerce" , contravariant = True )
24+ Tmpoly = TypeVar ("Tmpoly" , bound = flint_mpoly )
25+ Tctx = TypeVar ("Tctx" , bound = flint_mpoly_context )
1226
13- Telem = TypeVar ('Telem' , bound = flint_scalar )
14- Telem_coerce = TypeVar ('Telem_coerce' , contravariant = True )
15- Tmpoly = TypeVar ('Tmpoly' , bound = flint_mpoly )
16- Tctx = TypeVar ('Tctx' , bound = flint_mpoly_context )
17-
18- Sctx = TypeVar ('Sctx' , bound = flint_mpoly_context )
27+ Sctx = TypeVar ("Sctx" , bound = flint_mpoly_context )
1928
2029_str = str
2130
22-
2331class flint_elem :
24- pass
25-
32+ def str ( self ) -> _str : ...
33+ def repr ( self ) -> _str : ...
2634
2735class flint_scalar (flint_elem ):
2836 def is_zero (self ) -> bool : ...
29-
37+ def __pos__ (self ) -> Self : ...
38+ def __neg__ (self ) -> Self : ...
39+ def __add__ (self , other : Self | int , / ) -> Self : ...
40+ def __radd__ (self , other : int , / ) -> Self : ...
41+ def __sub__ (self , other : Self | int , / ) -> Self : ...
42+ def __rsub__ (self , other : int , / ) -> Self : ...
43+ def __mul__ (self , other : Self | int , / ) -> Self : ...
44+ def __rmul__ (self , other : int , / ) -> Self : ...
45+ def __truediv__ (self , other : Self | int , / ) -> Self : ...
46+ def __rtruediv__ (self , other : int , / ) -> Self : ...
47+ def __pow__ (self , other : int , / ) -> Self : ...
48+ def __rpow__ (self , other : int , / ) -> Self : ...
3049
3150class flint_poly (flint_elem , Generic [Telem ]):
51+ def str (
52+ self , ascending : bool = False , var : str = "x" , * args : Any , ** kwargs : Any
53+ ) -> str : ...
3254 def __iter__ (self ) -> Iterator [Telem ]: ...
3355 def __getitem__ (self , index : int , / ) -> Telem : ...
56+ def __setitem__ (self , index : int , value : Telem | int , / ) -> None : ...
57+ def __len__ (self ) -> int : ...
58+ def length (self ) -> int : ...
59+ def degree (self ) -> int : ...
3460 def coeffs (self ) -> list [Telem ]: ...
35- def str (self , ascending : bool = False , var : str = "x" , * args : Any , ** kwargs : Any ): ...
61+ @overload
62+ def __call__ (self , other : Telem | int , / ) -> Telem : ...
63+ @overload
64+ def __call__ (self , other : Self , / ) -> Self : ...
65+ def __pos__ (self ) -> Self : ...
66+ def __neg__ (self ) -> Self : ...
67+ def __add__ (self , other : Telem | int | Self , / ) -> Self : ...
68+ def __radd__ (self , other : Telem | int , / ) -> Self : ...
69+ def __sub__ (self , other : Telem | int | Self , / ) -> Self : ...
70+ def __rsub__ (self , other : Telem | int , / ) -> Self : ...
71+ def __mul__ (self , other : Telem | int | Self , / ) -> Self : ...
72+ def __rmul__ (self , other : Telem | int , / ) -> Self : ...
73+ def __truediv__ (self , other : Telem | int | Self , / ) -> Self : ...
74+ def __rtruediv__ (self , other : Telem | int , / ) -> Self : ...
75+ def __floordiv__ (self , other : Telem | int | Self , / ) -> Self : ...
76+ def __rfloordiv__ (self , other : Telem | int , / ) -> Self : ...
77+ def __mod__ (self , other : Telem | int | Self , / ) -> Self : ...
78+ def __rmod__ (self , other : Telem | int , / ) -> Self : ...
79+ def __divmod__ (self , other : Telem | int | Self , / ) -> tuple [Self , Self ]: ...
80+ def __rdivmod__ (self , other : Telem | int , / ) -> tuple [Self , Self ]: ...
81+ def __pow__ (self , other : int , / ) -> Self : ...
82+ def is_zero (self ) -> bool : ...
83+ def is_one (self ) -> bool : ...
84+ def is_constant (self ) -> bool : ...
85+ def is_gen (self ) -> bool : ...
3686 def roots (self ) -> list [tuple [Telem , int ]]: ...
3787 # Should be list[arb]:
3888 def real_roots (self ) -> list [Any ]: ...
3989 # Should be list[acb]:
4090 def complex_roots (self ) -> list [Any ]: ...
91+ def derivative (self ) -> Self : ...
4192
93+ class _flint_poly_exact (flint_poly [Telem ]):
94+ def sqrt (self ) -> Self : ...
95+ def gcd (self , other : Self | Telem , / ) -> Self : ...
96+ def xgcd (self , other : Self | Telem , / ) -> tuple [Self , Self , Self ]: ...
97+ def factor (self ) -> tuple [Telem , list [tuple [Self , int ]]]: ...
98+ def factor_squarefree (self ) -> tuple [Telem , list [tuple [Self , int ]]]: ...
99+ def resultant (self , other : Self | Telem , / ) -> Telem : ...
100+ def deflation (self ) -> tuple [Self , int ]: ...
42101
43102class Ordering (enum .Enum ):
44103 lex = "lex"
45104 deglex = "deglex"
46105 degrevlex = "degrevlex"
47106
48-
49107class flint_mpoly (flint_elem , Generic [Tctx , Telem , Telem_coerce ]):
50- def __init__ (self ,
51- val : Self | Telem | Telem_coerce | int | dict [tuple [int , ...], Telem | Telem_coerce | int ] | str = 0 ,
52- ctx : Tctx | None = None
108+ def __init__ (
109+ self ,
110+ val : Self
111+ | Telem
112+ | Telem_coerce
113+ | int
114+ | dict [tuple [int , ...], Telem | Telem_coerce | int ]
115+ | str = 0 ,
116+ ctx : Tctx | None = None ,
53117 ) -> None : ...
54-
55118 def str (self ) -> _str : ...
56119 def repr (self ) -> _str : ...
57-
58120 def context (self ) -> Tctx : ...
59-
60121 def degrees (self ) -> tuple [int , ...]: ...
61122 def total_degree (self ) -> int : ...
62-
63123 def leading_coefficient (self ) -> Telem : ...
64124 def to_dict (self ) -> dict [tuple [int , ...], Telem ]: ...
65-
66125 def is_one (self ) -> bool : ...
67126 def is_zero (self ) -> bool : ...
68127 def is_constant (self ) -> bool : ...
69-
70128 def __len__ (self ) -> int : ...
71129 def __getitem__ (self , index : tuple [int , ...]) -> Telem : ...
72- def __setitem__ (self , index : tuple [int , ...], coeff : Telem | Telem_coerce | int ) -> None : ...
130+ def __setitem__ (
131+ self , index : tuple [int , ...], coeff : Telem | Telem_coerce | int
132+ ) -> None : ...
73133 def __iter__ (self ) -> Iterable [tuple [int , ...]]: ...
74134 def __contains__ (self , index : tuple [int , ...]) -> bool : ...
75-
76135 def coefficient (self , i : int ) -> Telem : ...
77136 def monomial (self , i : int ) -> tuple [int , ...]: ...
78137 def terms (self ) -> Iterable [tuple [tuple [int , ...], Telem ]]: ...
79138 def monoms (self ) -> list [tuple [int , ...]]: ...
80139 def coeffs (self ) -> list [Telem ]: ...
81-
82140 def __pos__ (self ) -> Self : ...
83141 def __neg__ (self ) -> Self : ...
84142 def __add__ (self , other : Self | Telem | Telem_coerce | int ) -> Self : ...
@@ -93,80 +151,66 @@ class flint_mpoly(flint_elem, Generic[Tctx, Telem, Telem_coerce]):
93151 def __rfloordiv__ (self , other : Telem | Telem_coerce | int ) -> Self : ...
94152 def __mod__ (self , other : Self | Telem | Telem_coerce | int ) -> Self : ...
95153 def __rmod__ (self , other : Telem | Telem_coerce | int ) -> Self : ...
96- def __divmod__ (self , other : Self | Telem | Telem_coerce | int ) -> tuple [Self , Self ]: ...
154+ def __divmod__ (
155+ self , other : Self | Telem | Telem_coerce | int
156+ ) -> tuple [Self , Self ]: ...
97157 def __rdivmod__ (self , other : Telem | Telem_coerce | int ) -> tuple [Self , Self ]: ...
98158 def __pow__ (self , other : Telem | Telem_coerce | int ) -> Self : ...
99159 def __rpow__ (self , other : Telem | Telem_coerce | int ) -> Self : ...
100-
101160 def iadd (self , other : Telem | Telem_coerce | int ) -> None : ...
102161 def isub (self , other : Telem | Telem_coerce | int ) -> None : ...
103162 def imul (self , other : Telem | Telem_coerce | int ) -> None : ...
104-
105163 def gcd (self , other : Self ) -> Self : ...
106164 def term_content (self ) -> Self : ...
107-
108165 def factor (self ) -> tuple [Telem , Sequence [tuple [Self , int ]]]: ...
109166 def factor_squarefree (self ) -> tuple [Telem , Sequence [tuple [Self , int ]]]: ...
110-
111167 def sqrt (self ) -> Self : ...
112-
113168 def resultant (self , other : Self , var : _str | int ) -> Self : ...
114169 def discriminant (self , var : _str | int ) -> Self : ...
115-
116170 def deflation_index (self ) -> tuple [list [int ], list [int ]]: ...
117171 def deflation (self ) -> tuple [Self , list [int ]]: ...
118172 def deflation_monom (self ) -> tuple [Self , list [int ], Self ]: ...
119-
120173 def inflate (self , N : list [int ]) -> Self : ...
121174 def deflate (self , N : list [int ]) -> Self : ...
122-
123175 def subs (self , mapping : dict [_str | int , Telem | Telem_coerce | int ]) -> Self : ...
124176 def compose (self , * args : Self , ctx : Tctx | None = None ) -> Self : ...
125177 def __call__ (self , * args : Telem | Telem_coerce ) -> Telem : ...
126-
127178 def derivative (self , var : _str | int ) -> Self : ...
128-
129179 def unused_gens (self ) -> tuple [_str , ...]: ...
130-
131180 def project_to_context (
132- self ,
133- other_ctx : Tctx ,
134- mapping : dict [_str | int , _str | int ] | None = None
181+ self , other_ctx : Tctx , mapping : dict [_str | int , _str | int ] | None = None
135182 ) -> Self : ...
136183
137-
138184class flint_mpoly_context (flint_elem , Generic [Tmpoly , Telem , Telem_coerce ]):
139-
140185 def nvars (self ) -> int : ...
141186 def ordering (self ) -> Ordering : ...
142-
143187 def gen (self , i : int , / ) -> Tmpoly : ...
144188 def from_dict (self , d : Mapping [tuple [int , ...], Telem_coerce ], / ) -> Tmpoly : ...
145189 def constant (self , z : Telem_coerce , / ) -> Tmpoly : ...
146-
147190 def name (self , i : int , / ) -> str : ...
148191 def names (self ) -> tuple [str ]: ...
149192 def gens (self ) -> tuple [Tmpoly , ...]: ...
150193 def variable_to_index (self , var : str , / ) -> int : ...
151- def term (self , coeff : Telem_coerce | None = None , exp_vec : Iterable [int ] | None = None ) -> Tmpoly : ...
194+ def term (
195+ self , coeff : Telem_coerce | None = None , exp_vec : Iterable [int ] | None = None
196+ ) -> Tmpoly : ...
152197 def drop_gens (self , gens : Iterable [str | int ], / ) -> Self : ...
153198 def append_gens (self , gens : Iterable [str | int ], / ) -> Self : ...
154- def infer_generator_mapping (self , ctx : flint_mpoly_context , / ) -> dict [int , int ]: ...
155-
199+ def infer_generator_mapping (
200+ self , ctx : flint_mpoly_context , /
201+ ) -> dict [int , int ]: ...
156202 @classmethod
157- def from_context (cls ,
203+ def from_context (
204+ cls ,
158205 ctx : Sctx ,
159206 names : str | Iterable [str | tuple [str , int ]] | tuple [str , int ] | None = None ,
160207 ordering : Ordering | str = Ordering .lex ,
161- ) -> Sctx :
162- ...
163-
208+ ) -> Sctx : ...
164209
165210class flint_mod_mpoly_context (flint_mpoly_context [Tmpoly , Telem , Telem_coerce ]):
166211 @abstractmethod
167212 def modulus (self ) -> int : ...
168213
169-
170214class flint_series (flint_elem , Generic [Telem ]):
171215 """Base class for power series."""
172216 def __iter__ (self ) -> Iterator [Telem ]: ...
0 commit comments