FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fixed unused_gens for zero polynomial by oscarbenjamin · Pull Request #370 · flintlib/python-flint · GitHub

Repository navigation

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

Filter by extension

Filter by extension .py  (2) .pyi  (5) .pyx  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion src/flint/flint_base/flint_base.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class flint_mpoly_context(flint_elem, Generic[Tmpoly, Telem, Telem_coerce]):
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 names(self) -> tuple[str, ...]: ...
def gens(self) -> tuple[Tmpoly, ...]: ...
def variable_to_index(self, var: str, /) -> int: ...
def term(
Expand Down
2 changes: 1 addition & 1 deletion src/flint/flint_base/flint_base.pyx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ cdef class flint_mpoly(flint_elem):
('x0', 'x3')
"""
names = self.context().names()
return tuple(names[i] for i, x in enumerate(self.degrees()) if not x)
return tuple(names[i] for i, x in enumerate(self.degrees()) if x <= 0)

def project_to_context(self, other_ctx, mapping: dict[str | int, str | int] = None):
"""
Expand Down
2 changes: 2 additions & 0 deletions src/flint/test/test_all.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -3267,6 +3267,8 @@ def quick_poly():
)
new_poly = quick_poly().project_to_context(ctx1)
assert ctx1.drop_gens(new_poly.unused_gens()) == ctx
assert quick_poly().unused_gens() == ()
assert (0*quick_poly()).unused_gens() == ('x0', 'x1')
assert new_poly.project_to_context(ctx) == quick_poly()

new_poly = quick_poly().project_to_context(ctx2)
Expand Down
2 changes: 1 addition & 1 deletion src/flint/types/fmpq_mpoly.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class fmpq_mpoly_ctx(flint_mpoly_context[fmpq_mpoly, fmpq, ifmpq]):
def from_dict(self, d: Mapping[tuple[int, ...], ifmpq], /) -> fmpq_mpoly: ...
def constant(self, q: ifmpq, /) -> fmpq_mpoly: ...
def name(self, i: int, /) -> str: ...
def names(self) -> tuple[str]: ...
def names(self) -> tuple[str, ...]: ...
def gens(self) -> tuple[fmpq_mpoly, ...]: ...
def variable_to_index(self, var: str, /) -> int: ...
def term(
Expand Down
2 changes: 1 addition & 1 deletion src/flint/types/fmpz_mod_mpoly.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class fmpz_mod_mpoly_ctx(flint_mod_mpoly_context[fmpz_mod_mpoly, fmpz_mod, ifmpz
def constant(self, z: ifmpz_mod) -> fmpz_mod_mpoly: ...

def name(self, i: int, /) -> str: ...
def names(self) -> tuple[str]: ...
def names(self) -> tuple[str, ...]: ...
def gens(self) -> tuple[fmpz_mod_mpoly, ...]: ...
def variable_to_index(self, var: str, /) -> int: ...
def term(
Expand Down
2 changes: 1 addition & 1 deletion src/flint/types/fmpz_mpoly.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class fmpz_mpoly_ctx(flint_mpoly_context[fmpz_mpoly, fmpz, ifmpz]):
def from_dict(self, d: Mapping[tuple[int, ...], ifmpz], /) -> fmpz_mpoly: ...
def constant(self, z: ifmpz, /) -> fmpz_mpoly: ...
def name(self, i: int, /) -> str: ...
def names(self) -> tuple[str]: ...
def names(self) -> tuple[str, ...]: ...
def gens(self) -> tuple[fmpz_mpoly, ...]: ...
def variable_to_index(self, var: str, /) -> int: ...
def term(
Expand Down
2 changes: 1 addition & 1 deletion src/flint/types/nmod_mpoly.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class nmod_mpoly_ctx(flint_mod_mpoly_context[nmod_mpoly, nmod, inmod]):
def constant(self, z: inmod) -> nmod_mpoly: ...

def name(self, i: int, /) -> str: ...
def names(self) -> tuple[str]: ...
def names(self) -> tuple[str, ...]: ...
def gens(self) -> tuple[nmod_mpoly, ...]: ...
def variable_to_index(self, var: str, /) -> int: ...
def term(
Expand Down
2 changes: 1 addition & 1 deletion src/flint/typing.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def gen(self, i: int, /) -> _Tmpoly_p: ...
def from_dict(self, d: Mapping[tuple[int, ...], _Tscalar_contra | int], /) -> _Tmpoly_p: ...
def constant(self, z: _Tscalar_contra | int, /) -> _Tmpoly_p: ...
def name(self, i: int, /) -> str: ...
def names(self) -> tuple[str]: ...
def names(self) -> tuple[str, ...]: ...
def gens(self) -> tuple[_Tmpoly_p, ...]: ...
def variable_to_index(self, var: str, /) -> int: ...
def term(
Expand Down
Loading

Back | FazBrowse Home | New Git URL