Skip to content

Commit ee382ab

Browse files
committed
fmpz_mod_mat: add type stubs
1 parent db112c5 commit ee382ab

5 files changed

Lines changed: 65 additions & 19 deletions

File tree

src/flint/types/fmpq_mat.pyi

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@ from flint.types.fmpz_mat import fmpz_mat
1111

1212
_str = str
1313

14-
ifmpq_mat = fmpq_mat | fmpz_mat | Sequence[Sequence[ifmpq]]
15-
16-
1714
class fmpq_mat(flint_mat[fmpq]):
1815
@overload
19-
def __init__(self, val: ifmpq_mat, /) -> None: ...
16+
def __init__(self, val: fmpq_mat | fmpz_mat | Sequence[Sequence[ifmpq]], /) -> None: ...
2017
@overload
2118
def __init__(self, m: int, n: int, /) -> None: ...
2219
@overload

src/flint/types/fmpz_mat.pyi

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@ from flint.types.fmpz_poly import fmpz_poly
1010

1111
_str = str
1212

13-
ifmpz_mat = fmpz_mat | Sequence[Sequence[ifmpz]]
14-
15-
1613
class fmpz_mat(flint_mat[fmpz]):
1714
@overload
18-
def __init__(self, val: ifmpz_mat, /) -> None: ...
15+
def __init__(self, val: fmpz_mat | Sequence[Sequence[ifmpz]], /) -> None: ...
1916
@overload
2017
def __init__(self, m: int, n: int, /) -> None: ...
2118
@overload

src/flint/types/fmpz_mod_mat.pyi

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
from __future__ import annotations
2+
3+
from collections.abc import Sequence
4+
from typing import overload
5+
6+
from flint.flint_base.flint_base import flint_mat
7+
from flint.types.fmpz import fmpz
8+
from flint.types.fmpz_mat import fmpz_mat
9+
from flint.types.fmpz_mod import fmpz_mod, fmpz_mod_ctx, ifmpz_mod
10+
from flint.types.fmpz_mod_poly import fmpz_mod_poly
11+
from flint.types.nmod_mat import nmod_mat
12+
13+
class fmpz_mod_mat(flint_mat[fmpz_mod]):
14+
@overload
15+
def __init__(self, m: int, n: int, entries: Sequence[ifmpz_mod], ctx: fmpz_mod_ctx, /) -> None: ...
16+
@overload
17+
def __init__(self, m: int, n: int, ctx: fmpz_mod_ctx, /) -> None: ...
18+
@overload
19+
def __init__(self, val: Sequence[Sequence[ifmpz_mod]], ctx: fmpz_mod_ctx, /) -> None: ...
20+
@overload
21+
def __init__(self, val: fmpz_mod_mat | fmpz_mat | nmod_mat, ctx: fmpz_mod_ctx, /) -> None: ...
22+
@overload
23+
def __init__(self, val: fmpz_mod_mat | nmod_mat, /) -> None: ...
24+
25+
def nrows(self) -> int: ...
26+
def ncols(self) -> int: ...
27+
def modulus(self) -> fmpz: ...
28+
def repr(self) -> str: ...
29+
def entries(self) -> list[fmpz_mod]: ...
30+
def __getitem__(self, index: tuple[int, int], /) -> fmpz_mod: ...
31+
def __setitem__(self, index: tuple[int, int], value: ifmpz_mod, /) -> None: ...
32+
33+
def __bool__(self) -> bool: ...
34+
def __eq__(self, other: object, /) -> bool: ...
35+
def __ne__(self, other: object, /) -> bool: ...
36+
def __pos__(self) -> fmpz_mod_mat: ...
37+
def __neg__(self) -> fmpz_mod_mat: ...
38+
39+
def __add__(self, other: fmpz_mod_mat | fmpz_mat | nmod_mat, /) -> fmpz_mod_mat: ...
40+
def __radd__(self, other: fmpz_mod_mat | fmpz_mat | nmod_mat, /) -> fmpz_mod_mat: ...
41+
def __sub__(self, other: fmpz_mod_mat | fmpz_mat | nmod_mat, /) -> fmpz_mod_mat: ...
42+
def __rsub__(self, other: fmpz_mod_mat | fmpz_mat | nmod_mat, /) -> fmpz_mod_mat: ...
43+
def __mul__(self, other: fmpz_mod_mat | fmpz_mat | nmod_mat | ifmpz_mod, /) -> fmpz_mod_mat: ...
44+
def __rmul__(self, other: fmpz_mod_mat | fmpz_mat | nmod_mat | ifmpz_mod, /) -> fmpz_mod_mat: ...
45+
def __pow__(self, other: int, /) -> fmpz_mod_mat: ...
46+
def __truediv__(self, other: ifmpz_mod, /) -> fmpz_mod_mat: ...
47+
48+
def inv(self) -> fmpz_mod_mat: ...
49+
def det(self) -> fmpz_mod: ...
50+
def charpoly(self) -> fmpz_mod_poly: ...
51+
def minpoly(self) -> fmpz_mod_poly: ...
52+
def transpose(self) -> fmpz_mod_mat: ...
53+
def solve(self, rhs: fmpz_mod_mat | nmod_mat, /) -> fmpz_mod_mat: ...
54+
def rank(self) -> int: ...
55+
def rref(self, inplace: bool = False, /) -> tuple[fmpz_mod_mat, int]: ...

src/flint/types/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pyfiles = [
2626
'fmpz_mod.pyi',
2727
'fmpz_mod_poly.pyi',
2828
'fmpz_mod_mpoly.pyi',
29-
# 'fmpz_mod_mat.pyi',
29+
'fmpz_mod_mat.pyi',
3030

3131
'fq_default.pyi',
3232
'fq_default_poly.pyi',

src/flint/types/nmod_mat.pyi

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ from flint.types.nmod_poly import nmod_poly
1111

1212
_str = str
1313

14-
inmod_mat = nmod_mat | fmpz_mat | Sequence[Sequence[inmod]]
15-
16-
1714
class nmod_mat(flint_mat[nmod]):
1815
@overload
1916
def __init__(self, val: nmod_mat, /) -> None: ...
@@ -47,19 +44,19 @@ class nmod_mat(flint_mat[nmod]):
4744

4845
def __pos__(self) -> nmod_mat: ...
4946
def __neg__(self) -> nmod_mat: ...
50-
def __add__(self, other: inmod_mat, /) -> nmod_mat: ...
51-
def __radd__(self, other: inmod_mat, /) -> nmod_mat: ...
52-
def __sub__(self, other: inmod_mat, /) -> nmod_mat: ...
53-
def __rsub__(self, other: inmod_mat, /) -> nmod_mat: ...
54-
def __mul__(self, other: inmod_mat | inmod, /) -> nmod_mat: ...
55-
def __rmul__(self, other: inmod_mat | inmod, /) -> nmod_mat: ...
47+
def __add__(self, other: nmod_mat | fmpz_mat, /) -> nmod_mat: ...
48+
def __radd__(self, other: nmod_mat | fmpz_mat, /) -> nmod_mat: ...
49+
def __sub__(self, other: nmod_mat | fmpz_mat, /) -> nmod_mat: ...
50+
def __rsub__(self, other: nmod_mat | fmpz_mat, /) -> nmod_mat: ...
51+
def __mul__(self, other: nmod_mat | fmpz_mat | inmod, /) -> nmod_mat: ...
52+
def __rmul__(self, other: nmod_mat | fmpz_mat | inmod, /) -> nmod_mat: ...
5653
def __truediv__(self, other: inmod, /) -> nmod_mat: ...
5754
def __pow__(self, exponent: int, modulo: None = None, /) -> nmod_mat: ...
5855

5956
def det(self) -> nmod: ...
6057
def inv(self) -> nmod_mat: ...
6158
def transpose(self) -> nmod_mat: ...
62-
def solve(self, other: inmod_mat, /) -> nmod_mat: ...
59+
def solve(self, other: nmod_mat | fmpz_mat, /) -> nmod_mat: ...
6360
def rref(self, inplace: bool = False, /) -> tuple[nmod_mat, int]: ...
6461
def rank(self) -> int: ...
6562
def nullspace(self) -> tuple[nmod_mat, int]: ...

0 commit comments

Comments
 (0)