Skip to content

Commit 98af07c

Browse files
Merge branch 'main' into pr_fmpq_fmpq
2 parents d7c0f76 + 49e2e18 commit 98af07c

File tree

15 files changed

+1365
-715
lines changed

15 files changed

+1365
-715
lines changed

src/flint/flint_base/flint_base.pyi

Lines changed: 63 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#
22
#
33
#
4-
from typing import Generic, TypeVar, Iterator, Iterable, Any, Final, Self, Mapping
4+
from typing import Generic, TypeVar, Iterator, Iterable, Any, Final, Self, Mapping, Sequence
5+
from abc import abstractmethod
56
import enum
67

78

@@ -10,12 +11,14 @@ FLINT_RELEASE: Final[int]
1011

1112

1213
Telem = TypeVar('Telem', bound=flint_scalar)
13-
Telem_coerce = TypeVar('Telem_coerce')
14+
Telem_coerce = TypeVar('Telem_coerce', contravariant=True)
1415
Tmpoly = TypeVar('Tmpoly', bound=flint_mpoly)
1516
Tctx = TypeVar('Tctx', bound=flint_mpoly_context)
1617

1718
Sctx = TypeVar('Sctx', bound=flint_mpoly_context)
1819

20+
_str = str
21+
1922

2023
class flint_elem:
2124
pass
@@ -27,7 +30,7 @@ class flint_scalar(flint_elem):
2730

2831
class flint_poly(flint_elem, Generic[Telem]):
2932
def __iter__(self) -> Iterator[Telem]: ...
30-
def __getitem__(self, index: int) -> Telem: ...
33+
def __getitem__(self, index: int, /) -> Telem: ...
3134
def coeffs(self) -> list[Telem]: ...
3235
def str(self, ascending: bool = False, var: str = "x", *args: Any, **kwargs: Any): ...
3336
def roots(self) -> list[tuple[Telem, int]]: ...
@@ -49,8 +52,8 @@ class flint_mpoly(flint_elem, Generic[Tctx, Telem, Telem_coerce]):
4952
ctx: Tctx | None = None
5053
) -> None: ...
5154

52-
def str(self) -> str: ...
53-
def repr(self) -> str: ...
55+
def str(self) -> _str: ...
56+
def repr(self) -> _str: ...
5457

5558
def context(self) -> Tctx: ...
5659

@@ -59,25 +62,22 @@ class flint_mpoly(flint_elem, Generic[Tctx, Telem, Telem_coerce]):
5962

6063
def leading_coefficient(self) -> Telem: ...
6164
def to_dict(self) -> dict[tuple[int, ...], Telem]: ...
62-
def terms(self) -> Iterable[tuple[tuple[int, ...], Telem]]: ...
6365

6466
def is_one(self) -> bool: ...
6567
def is_zero(self) -> bool: ...
6668
def is_constant(self) -> bool: ...
6769

6870
def __len__(self) -> int: ...
71+
def __getitem__(self, index: tuple[int, ...]) -> Telem: ...
72+
def __setitem__(self, index: tuple[int, ...], coeff: Telem | Telem_coerce | int) -> None: ...
73+
def __iter__(self) -> Iterable[tuple[int, ...]]: ...
74+
def __contains__(self, index: tuple[int, ...]) -> bool: ...
75+
6976
def coefficient(self, i: int) -> Telem: ...
7077
def monomial(self, i: int) -> tuple[int, ...]: ...
71-
78+
def terms(self) -> Iterable[tuple[tuple[int, ...], Telem]]: ...
7279
def monoms(self) -> list[tuple[int, ...]]: ...
7380
def coeffs(self) -> list[Telem]: ...
74-
def __getitem__(self, index: tuple[int, ...]) -> Telem: ...
75-
def __setitem__(self, index: tuple[int, ...], coeff: Telem | Telem_coerce | int) -> None: ...
76-
77-
def subs(self, mapping: dict[str | int, Telem | Telem_coerce | int]) -> Self: ...
78-
def compose(self, *args: Self, ctx: Tctx | None = None) -> Self: ...
79-
80-
def __call__(self, *args: Telem | Telem_coerce) -> Telem: ...
8181

8282
def __pos__(self) -> Self: ...
8383
def __neg__(self) -> Self: ...
@@ -97,15 +97,41 @@ class flint_mpoly(flint_elem, Generic[Tctx, Telem, Telem_coerce]):
9797
def __rdivmod__(self, other: Telem | Telem_coerce | int) -> tuple[Self, Self]: ...
9898
def __pow__(self, other: Telem | Telem_coerce | int) -> Self: ...
9999
def __rpow__(self, other: Telem | Telem_coerce | int) -> Self: ...
100-
def __iter__(self) -> Iterable[tuple[int, ...]]: ...
101-
def __contains__(self, index: tuple[int, ...]) -> bool: ...
102100

103-
def unused_gens(self) -> tuple[str, ...]: ...
101+
def iadd(self, other: Telem | Telem_coerce | int) -> None: ...
102+
def isub(self, other: Telem | Telem_coerce | int) -> None: ...
103+
def imul(self, other: Telem | Telem_coerce | int) -> None: ...
104+
105+
def gcd(self, other: Self) -> Self: ...
106+
def term_content(self) -> Self: ...
107+
108+
def factor(self) -> tuple[Telem, Sequence[tuple[Self, int]]]: ...
109+
def factor_squarefree(self) -> tuple[Telem, Sequence[tuple[Self, int]]]: ...
110+
111+
def sqrt(self) -> Self: ...
112+
113+
def resultant(self, other: Self, var: _str | int) -> Self: ...
114+
def discriminant(self, var: _str | int) -> Self: ...
115+
116+
def deflation_index(self) -> tuple[list[int], list[int]]: ...
117+
def deflation(self) -> tuple[Self, list[int]]: ...
118+
def deflation_monom(self) -> tuple[Self, list[int], Self]: ...
119+
120+
def inflate(self, N: list[int]) -> Self: ...
121+
def deflate(self, N: list[int]) -> Self: ...
122+
123+
def subs(self, mapping: dict[_str | int, Telem | Telem_coerce | int]) -> Self: ...
124+
def compose(self, *args: Self, ctx: Tctx | None = None) -> Self: ...
125+
def __call__(self, *args: Telem | Telem_coerce) -> Telem: ...
126+
127+
def derivative(self, var: _str | int) -> Self: ...
128+
129+
def unused_gens(self) -> tuple[_str, ...]: ...
104130

105131
def project_to_context(
106132
self,
107133
other_ctx: Tctx,
108-
mapping: dict[str | int, str | int] | None = None
134+
mapping: dict[_str | int, _str | int] | None = None
109135
) -> Self: ...
110136

111137

@@ -114,18 +140,18 @@ class flint_mpoly_context(flint_elem, Generic[Tmpoly, Telem, Telem_coerce]):
114140
def nvars(self) -> int: ...
115141
def ordering(self) -> Ordering: ...
116142

117-
def gen(self, i: int) -> Tmpoly: ...
118-
def from_dict(self, d: Mapping[tuple[int, ...], Telem_coerce]) -> Tmpoly: ...
119-
def constant(self, z: Telem_coerce) -> Tmpoly: ...
143+
def gen(self, i: int, /) -> Tmpoly: ...
144+
def from_dict(self, d: Mapping[tuple[int, ...], Telem_coerce], /) -> Tmpoly: ...
145+
def constant(self, z: Telem_coerce, /) -> Tmpoly: ...
120146

121-
def name(self, i: int) -> str: ...
147+
def name(self, i: int, /) -> str: ...
122148
def names(self) -> tuple[str]: ...
123149
def gens(self) -> tuple[Tmpoly, ...]: ...
124-
def variable_to_index(self, var: str) -> int: ...
150+
def variable_to_index(self, var: str, /) -> int: ...
125151
def term(self, coeff: Telem_coerce | None = None, exp_vec: Iterable[int] | None = None) -> Tmpoly: ...
126-
def drop_gens(self, gens: Iterable[str | int]) -> Self: ...
127-
def append_gens(self, gens: Iterable[str | int]) -> Self: ...
128-
def infer_generator_mapping(self, ctx: flint_mpoly_context) -> dict[int, int]: ...
152+
def drop_gens(self, gens: Iterable[str | int], /) -> Self: ...
153+
def append_gens(self, gens: Iterable[str | int], /) -> Self: ...
154+
def infer_generator_mapping(self, ctx: flint_mpoly_context, /) -> dict[int, int]: ...
129155

130156
@classmethod
131157
def from_context(cls,
@@ -134,3 +160,14 @@ class flint_mpoly_context(flint_elem, Generic[Tmpoly, Telem, Telem_coerce]):
134160
ordering: Ordering | str = Ordering.lex,
135161
) -> Sctx:
136162
...
163+
164+
165+
class flint_mod_mpoly_context(flint_mpoly_context[Tmpoly, Telem, Telem_coerce]):
166+
@abstractmethod
167+
def modulus(self) -> int: ...
168+
169+
170+
class flint_series(flint_elem, Generic[Telem]):
171+
"""Base class for power series."""
172+
def __iter__(self) -> Iterator[Telem]: ...
173+
def coeffs(self) -> list[Telem]: ...

0 commit comments

Comments
 (0)