Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 63 additions & 26 deletions src/flint/flint_base/flint_base.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#
#
#
from typing import Generic, TypeVar, Iterator, Iterable, Any, Final, Self, Mapping
from typing import Generic, TypeVar, Iterator, Iterable, Any, Final, Self, Mapping, Sequence
from abc import abstractmethod
import enum


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


Telem = TypeVar('Telem', bound=flint_scalar)
Telem_coerce = TypeVar('Telem_coerce')
Telem_coerce = TypeVar('Telem_coerce', contravariant=True)
Tmpoly = TypeVar('Tmpoly', bound=flint_mpoly)
Tctx = TypeVar('Tctx', bound=flint_mpoly_context)

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

_str = str


class flint_elem:
pass
Expand All @@ -27,7 +30,7 @@ class flint_scalar(flint_elem):

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

def str(self) -> str: ...
def repr(self) -> str: ...
def str(self) -> _str: ...
def repr(self) -> _str: ...

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

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

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

def is_one(self) -> bool: ...
def is_zero(self) -> bool: ...
def is_constant(self) -> bool: ...

def __len__(self) -> int: ...
def __getitem__(self, index: tuple[int, ...]) -> Telem: ...
def __setitem__(self, index: tuple[int, ...], coeff: Telem | Telem_coerce | int) -> None: ...
def __iter__(self) -> Iterable[tuple[int, ...]]: ...
def __contains__(self, index: tuple[int, ...]) -> bool: ...

def coefficient(self, i: int) -> Telem: ...
def monomial(self, i: int) -> tuple[int, ...]: ...

def terms(self) -> Iterable[tuple[tuple[int, ...], Telem]]: ...
def monoms(self) -> list[tuple[int, ...]]: ...
def coeffs(self) -> list[Telem]: ...
def __getitem__(self, index: tuple[int, ...]) -> Telem: ...
def __setitem__(self, index: tuple[int, ...], coeff: Telem | Telem_coerce | int) -> None: ...

def subs(self, mapping: dict[str | int, Telem | Telem_coerce | int]) -> Self: ...
def compose(self, *args: Self, ctx: Tctx | None = None) -> Self: ...

def __call__(self, *args: Telem | Telem_coerce) -> Telem: ...

def __pos__(self) -> Self: ...
def __neg__(self) -> Self: ...
Expand All @@ -97,15 +97,41 @@ class flint_mpoly(flint_elem, Generic[Tctx, Telem, Telem_coerce]):
def __rdivmod__(self, other: Telem | Telem_coerce | int) -> tuple[Self, Self]: ...
def __pow__(self, other: Telem | Telem_coerce | int) -> Self: ...
def __rpow__(self, other: Telem | Telem_coerce | int) -> Self: ...
def __iter__(self) -> Iterable[tuple[int, ...]]: ...
def __contains__(self, index: tuple[int, ...]) -> bool: ...

def unused_gens(self) -> tuple[str, ...]: ...
def iadd(self, other: Telem | Telem_coerce | int) -> None: ...
def isub(self, other: Telem | Telem_coerce | int) -> None: ...
def imul(self, other: Telem | Telem_coerce | int) -> None: ...

def gcd(self, other: Self) -> Self: ...
def term_content(self) -> Self: ...

def factor(self) -> tuple[Telem, Sequence[tuple[Self, int]]]: ...
def factor_squarefree(self) -> tuple[Telem, Sequence[tuple[Self, int]]]: ...

def sqrt(self) -> Self: ...

def resultant(self, other: Self, var: _str | int) -> Self: ...
def discriminant(self, var: _str | int) -> Self: ...

def deflation_index(self) -> tuple[list[int], list[int]]: ...
def deflation(self) -> tuple[Self, list[int]]: ...
def deflation_monom(self) -> tuple[Self, list[int], Self]: ...

def inflate(self, N: list[int]) -> Self: ...
def deflate(self, N: list[int]) -> Self: ...

def subs(self, mapping: dict[_str | int, Telem | Telem_coerce | int]) -> Self: ...
def compose(self, *args: Self, ctx: Tctx | None = None) -> Self: ...
def __call__(self, *args: Telem | Telem_coerce) -> Telem: ...

def derivative(self, var: _str | int) -> Self: ...

def unused_gens(self) -> tuple[_str, ...]: ...

def project_to_context(
self,
other_ctx: Tctx,
mapping: dict[str | int, str | int] | None = None
mapping: dict[_str | int, _str | int] | None = None
) -> Self: ...


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

def gen(self, i: int) -> Tmpoly: ...
def from_dict(self, d: Mapping[tuple[int, ...], Telem_coerce]) -> Tmpoly: ...
def constant(self, z: Telem_coerce) -> Tmpoly: ...
def gen(self, i: int, /) -> Tmpoly: ...
def from_dict(self, d: Mapping[tuple[int, ...], Telem_coerce], /) -> Tmpoly: ...
def constant(self, z: Telem_coerce, /) -> Tmpoly: ...

def name(self, i: int) -> str: ...
def name(self, i: int, /) -> str: ...
def names(self) -> tuple[str]: ...
def gens(self) -> tuple[Tmpoly, ...]: ...
def variable_to_index(self, var: str) -> int: ...
def variable_to_index(self, var: str, /) -> int: ...
def term(self, coeff: Telem_coerce | None = None, exp_vec: Iterable[int] | None = None) -> Tmpoly: ...
def drop_gens(self, gens: Iterable[str | int]) -> Self: ...
def append_gens(self, gens: Iterable[str | int]) -> Self: ...
def infer_generator_mapping(self, ctx: flint_mpoly_context) -> dict[int, int]: ...
def drop_gens(self, gens: Iterable[str | int], /) -> Self: ...
def append_gens(self, gens: Iterable[str | int], /) -> Self: ...
def infer_generator_mapping(self, ctx: flint_mpoly_context, /) -> dict[int, int]: ...

@classmethod
def from_context(cls,
Expand All @@ -134,3 +160,14 @@ class flint_mpoly_context(flint_elem, Generic[Tmpoly, Telem, Telem_coerce]):
ordering: Ordering | str = Ordering.lex,
) -> Sctx:
...


class flint_mod_mpoly_context(flint_mpoly_context[Tmpoly, Telem, Telem_coerce]):
@abstractmethod
def modulus(self) -> int: ...


class flint_series(flint_elem, Generic[Telem]):
"""Base class for power series."""
def __iter__(self) -> Iterator[Telem]: ...
def coeffs(self) -> list[Telem]: ...
Loading
Loading