Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

get rid of one ParentWithGens #36893

Merged
merged 1 commit into from
Jan 14, 2024
Merged
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
9 changes: 4 additions & 5 deletions src/sage/rings/polynomial/ore_polynomial_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ from sage.structure.element import coerce_binop
from sage.rings.infinity import infinity
from sage.structure.element cimport Element, RingElement, AlgebraElement
from sage.structure.parent cimport Parent
from sage.structure.parent_gens cimport ParentWithGens
from sage.categories.homset import Hom
from sage.rings.ring import _Fields
from sage.rings.integer cimport Integer
Expand Down Expand Up @@ -2338,9 +2337,9 @@ cdef class OrePolynomial_generic_dense(OrePolynomial):
cdef long c_hash
cdef long var_name_hash = 0
cdef int i
for i from 0 <= i < len(self._coeffs):
for i in range(len(self._coeffs)):
if i == 1:
var_name_hash = hash((<ParentWithGens>self._parent)._names[0])
var_name_hash = hash(self._parent._names[0])
c_hash = hash(self._coeffs[i])
if c_hash != 0:
if i == 0:
Expand Down Expand Up @@ -2576,9 +2575,9 @@ cdef class OrePolynomial_generic_dense(OrePolynomial):
cdef list y = (<OrePolynomial_generic_dense>right)._coeffs
cdef Py_ssize_t dx = len(x), dy = len(y)
if dx > dy:
r = self._new_c([x[i] + y[i] for i from 0 <= i < dy] + x[dy:], self._parent, 0)
r = self._new_c([x[i] + y[i] for i in range(dy)] + x[dy:], self._parent, 0)
elif dx < dy:
r = self._new_c([x[i] + y[i] for i from 0 <= i < dx] + y[dx:], self._parent, 0)
r = self._new_c([x[i] + y[i] for i in range(dx)] + y[dx:], self._parent, 0)
else:
r = self._new_c([x[i] + y[i] for i in range(dx)], self._parent, 1)
return r
Expand Down
Loading