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
112 changes: 84 additions & 28 deletions src/flint/__init__.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
from .pyflint import *
from .pyflint import ctx

from .types.fmpz import *
from .types.fmpz_poly import *
from .types.fmpz_mat import *
from .types.fmpz_series import *
from .types.fmpz import fmpz
from .types.fmpz_poly import fmpz_poly
from .types.fmpz_mat import fmpz_mat
from .types.fmpz_series import fmpz_series
from .types.fmpz_vec import fmpz_vec

from .types.fmpq import *
from .types.fmpq_poly import *
from .types.fmpq_mat import *
from .types.fmpq_series import *
from .types.fmpq import fmpq
from .types.fmpq_poly import fmpq_poly
from .types.fmpq_mat import fmpq_mat
from .types.fmpq_series import fmpq_series
from .types.fmpq_vec import fmpq_vec

from .types.nmod import *
from .types.nmod_poly import *
from .types.nmod import nmod
from .types.nmod_poly import nmod_poly
from .types.nmod_mpoly import nmod_mpoly_ctx, nmod_mpoly, nmod_mpoly_vec
from .types.nmod_mat import *
from .types.nmod_series import *
from .types.nmod_mat import nmod_mat
from .types.nmod_series import nmod_series

from .types.fmpz_mpoly import fmpz_mpoly_ctx, fmpz_mpoly, fmpz_mpoly_vec
from .types.fmpz_mod import *
from .types.fmpz_mod_poly import *
from .types.fmpz_mod import fmpz_mod, fmpz_mod_ctx
from .types.fmpz_mod_poly import fmpz_mod_poly, fmpz_mod_poly_ctx
from .types.fmpz_mod_mpoly import fmpz_mod_mpoly_ctx, fmpz_mod_mpoly, fmpz_mod_mpoly_vec
from .types.fmpz_mod_mat import fmpz_mod_mat

from .types.fmpq_mpoly import fmpq_mpoly_ctx, fmpq_mpoly, fmpq_mpoly_vec

from .types.fq_default import *
from .types.fq_default_poly import *
from .types.fq_default import fq_default, fq_default_ctx
from .types.fq_default_poly import fq_default_poly, fq_default_poly_ctx

from .types.arf import *
from .types.arb import *
from .types.arb_poly import *
from .types.arb_mat import *
from .types.arb_series import *
from .types.acb import *
from .types.acb_poly import *
from .types.acb_mat import *
from .types.acb_series import *
from .types.arf import arf
from .types.arb import arb
from .types.arb_poly import arb_poly
from .types.arb_mat import arb_mat
from .types.arb_series import arb_series
from .types.acb import acb
from .types.acb_poly import acb_poly
from .types.acb_mat import acb_mat
from .types.acb_series import acb_series

from .types.dirichlet import *
from .types.dirichlet import dirichlet_char, dirichlet_group
from .functions.showgood import good, showgood

from .flint_base.flint_base import (
Expand All @@ -48,4 +48,60 @@
Ordering,
)

__version__ = '0.7.1'
__version__ = "0.7.1"

__all__ = [
"ctx",
"fmpz",
"fmpz_poly",
"fmpz_mat",
"fmpz_series",
"fmpz_vec",
"fmpq",
"fmpq_poly",
"fmpq_mat",
"fmpq_series",
"fmpq_vec",
"nmod",
"nmod_poly",
"nmod_mpoly_ctx",
"nmod_mpoly",
"nmod_mpoly_vec",
"nmod_mat",
"nmod_series",
"fmpz_mpoly_ctx",
"fmpz_mpoly",
"fmpz_mpoly_vec",
"fmpz_mod",
"fmpz_mod_ctx",
"fmpz_mod_poly",
"fmpz_mod_poly_ctx",
"fmpz_mod_mpoly_ctx",
"fmpz_mod_mpoly",
"fmpz_mod_mpoly_vec",
"fmpz_mod_mat",
"fmpq_mpoly_ctx",
"fmpq_mpoly",
"fmpq_mpoly_vec",
"fq_default",
"fq_default_ctx",
"fq_default_poly",
"fq_default_poly_ctx",
"arf",
"arb",
"arb_poly",
"arb_mat",
"arb_series",
"acb",
"acb_poly",
"acb_mat",
"acb_series",
"dirichlet_char",
"dirichlet_group",
"good",
"showgood",
"Ordering",
"__FLINT_VERSION__",
"__FLINT_RELEASE__",
"__version__",
]
136 changes: 136 additions & 0 deletions src/flint/flint_base/flint_base.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#
#
#
from typing import Generic, TypeVar, Iterator, Iterable, Any, Final, Self, Mapping
import enum


FLINT_VERSION: Final[str]
FLINT_RELEASE: Final[int]


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

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


class flint_elem:
pass


class flint_scalar(flint_elem):
def is_zero(self) -> bool: ...


class flint_poly(flint_elem, Generic[Telem]):
def __iter__(self) -> Iterator[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]]: ...
# Should be list[arb]:
def real_roots(self) -> list[Any]: ...
# Should be list[acb]:
def complex_roots(self) -> list[Any]: ...


class Ordering(enum.Enum):
lex = "lex"
deglex = "deglex"
degrevlex = "degrevlex"


class flint_mpoly(flint_elem, Generic[Tctx, Telem, Telem_coerce]):
def __init__(self,
val: Self | Telem | Telem_coerce | int | dict[tuple[int, ...], Telem | Telem_coerce | int] | str = 0,
ctx: Tctx | None = None
) -> None: ...

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

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

def degrees(self) -> tuple[int, ...]: ...
def total_degree(self) -> int: ...

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 coefficient(self, i: int) -> Telem: ...
def monomial(self, i: int) -> tuple[int, ...]: ...

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: ...
def __add__(self, other: Self | Telem | Telem_coerce | int) -> Self: ...
def __radd__(self, other: Telem | Telem_coerce | int) -> Self: ...
def __sub__(self, other: Self | Telem | Telem_coerce | int) -> Self: ...
def __rsub__(self, other: Telem | Telem_coerce | int) -> Self: ...
def __mul__(self, other: Self | Telem | Telem_coerce | int) -> Self: ...
def __rmul__(self, other: Telem | Telem_coerce | int) -> Self: ...
def __truediv__(self, other: Self | Telem | Telem_coerce | int) -> Self: ...
def __rtruediv__(self, other: Telem | Telem_coerce | int) -> Self: ...
def __floordiv__(self, other: Self | Telem | Telem_coerce | int) -> Self: ...
def __rfloordiv__(self, other: Telem | Telem_coerce | int) -> Self: ...
def __mod__(self, other: Self | Telem | Telem_coerce | int) -> Self: ...
def __rmod__(self, other: Telem | Telem_coerce | int) -> Self: ...
def __divmod__(self, other: Self | Telem | Telem_coerce | int) -> tuple[Self, Self]: ...
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 project_to_context(
self,
other_ctx: Tctx,
mapping: dict[str | int, str | int] | None = None
) -> Self: ...


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 name(self, i: int) -> str: ...
def names(self) -> tuple[str]: ...
def gens(self) -> tuple[Tmpoly, ...]: ...
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]: ...

@classmethod
def from_context(cls,
ctx: Sctx,
names: str | Iterable[str | tuple[str, int]] | tuple[str, int] | None = None,
ordering: Ordering | str = Ordering.lex,
) -> Sctx:
...
Loading
Loading