Skip to content

Commit

Permalink
Merge remote-tracking branch 'tornaria/noexcept' into copy
Browse files Browse the repository at this point in the history
  • Loading branch information
gmou3 committed Apr 1, 2024
2 parents 04e89d4 + bcc326d commit 1d1825f
Show file tree
Hide file tree
Showing 656 changed files with 5,167 additions and 5,171 deletions.
4 changes: 2 additions & 2 deletions src/sage/algebras/clifford_algebra_element.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ from sage.modules.with_basis.indexed_element cimport IndexedFreeModuleElement
from sage.data_structures.bitset cimport FrozenBitset

cdef class CliffordAlgebraElement(IndexedFreeModuleElement):
cdef CliffordAlgebraElement _mul_self_term(self, FrozenBitset supp, coeff) noexcept
cdef CliffordAlgebraElement _mul_term_self(self, FrozenBitset supp, coeff) noexcept
cdef CliffordAlgebraElement _mul_self_term(self, FrozenBitset supp, coeff)
cdef CliffordAlgebraElement _mul_term_self(self, FrozenBitset supp, coeff)

cdef class ExteriorAlgebraElement(CliffordAlgebraElement):
pass
Expand Down
14 changes: 7 additions & 7 deletions src/sage/algebras/clifford_algebra_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ cdef class CliffordAlgebraElement(IndexedFreeModuleElement):
"""
return repr_from_monomials(self.list(), self._parent._latex_term, True)

cdef _mul_(self, other) noexcept:
cdef _mul_(self, other):
"""
Return ``self`` multiplied by ``other``.
Expand Down Expand Up @@ -176,7 +176,7 @@ cdef class CliffordAlgebraElement(IndexedFreeModuleElement):

return self.__class__(self.parent(), d)

cdef CliffordAlgebraElement _mul_self_term(self, FrozenBitset supp, coeff) noexcept:
cdef CliffordAlgebraElement _mul_self_term(self, FrozenBitset supp, coeff):
r"""
Multiply ``self * term`` with the ``term`` having support ``supp``
and coefficient ``coeff``.
Expand Down Expand Up @@ -224,7 +224,7 @@ cdef class CliffordAlgebraElement(IndexedFreeModuleElement):

return type(self)(self._parent, {supp: coeff}) * self

cdef CliffordAlgebraElement _mul_term_self(self, FrozenBitset supp, coeff) noexcept:
cdef CliffordAlgebraElement _mul_term_self(self, FrozenBitset supp, coeff):
r"""
Multiply ``term * self`` with the ``term`` having support ``supp``
and coefficient ``coeff``.
Expand Down Expand Up @@ -400,7 +400,7 @@ cdef class ExteriorAlgebraElement(CliffordAlgebraElement):
"""
An element of an exterior algebra.
"""
cdef _mul_(self, other) noexcept:
cdef _mul_(self, other):
"""
Return ``self`` multiplied by ``other``.
Expand Down Expand Up @@ -520,7 +520,7 @@ cdef class ExteriorAlgebraElement(CliffordAlgebraElement):

return self.__class__(P, d)

cdef CliffordAlgebraElement _mul_self_term(self, FrozenBitset supp, coeff) noexcept:
cdef CliffordAlgebraElement _mul_self_term(self, FrozenBitset supp, coeff):
r"""
Multiply ``self * term`` with the ``term`` having support ``supp``
and coefficient ``coeff``.
Expand Down Expand Up @@ -610,7 +610,7 @@ cdef class ExteriorAlgebraElement(CliffordAlgebraElement):
del d[k]
return type(self)(self._parent, d)

cdef CliffordAlgebraElement _mul_term_self(self, FrozenBitset supp, coeff) noexcept:
cdef CliffordAlgebraElement _mul_term_self(self, FrozenBitset supp, coeff):
r"""
Multiply ``term * self`` with the ``term`` having support ``supp``
and coefficient ``coeff``.
Expand Down Expand Up @@ -939,7 +939,7 @@ cdef class CohomologyRAAGElement(CliffordAlgebraElement):
:class:`~sage.groups.raag.CohomologyRAAG`
"""
cdef _mul_(self, other) noexcept:
cdef _mul_(self, other):
"""
Return ``self`` multiplied by ``other``.
Expand Down
24 changes: 12 additions & 12 deletions src/sage/algebras/exterior_algebra_groebner.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ from sage.structure.parent cimport Parent
from sage.structure.element cimport MonoidElement

cdef long degree(FrozenBitset X) noexcept
cdef CliffordAlgebraElement build_monomial(Parent E, FrozenBitset supp) noexcept
cdef CliffordAlgebraElement build_monomial(Parent E, FrozenBitset supp)

cdef class GBElement:
cdef CliffordAlgebraElement elt
Expand All @@ -24,25 +24,25 @@ cdef class GroebnerStrategy:
cdef Integer rank
cdef public tuple groebner_basis

cdef inline GBElement build_elt(self, CliffordAlgebraElement f) noexcept
cdef inline GBElement prod_GB_term(self, GBElement f, FrozenBitset t) noexcept
cdef inline GBElement prod_term_GB(self, FrozenBitset t, GBElement f) noexcept
cdef inline GBElement build_elt(self, CliffordAlgebraElement f)
cdef inline GBElement prod_GB_term(self, GBElement f, FrozenBitset t)
cdef inline GBElement prod_term_GB(self, FrozenBitset t, GBElement f)
cdef inline bint build_S_poly(self, GBElement f, GBElement g) noexcept

cdef inline FrozenBitset leading_support(self, CliffordAlgebraElement f) noexcept
cdef inline partial_S_poly_left(self, GBElement f, GBElement g) noexcept
cdef inline partial_S_poly_right(self, GBElement f, GBElement g) noexcept
cdef set preprocessing(self, list P, list G) noexcept
cdef list reduction(self, list P, list G) noexcept
cdef inline FrozenBitset leading_support(self, CliffordAlgebraElement f)
cdef inline partial_S_poly_left(self, GBElement f, GBElement g)
cdef inline partial_S_poly_right(self, GBElement f, GBElement g)
cdef set preprocessing(self, list P, list G)
cdef list reduction(self, list P, list G)

cpdef CliffordAlgebraElement reduce(self, CliffordAlgebraElement f) noexcept
cpdef CliffordAlgebraElement reduce(self, CliffordAlgebraElement f)
cdef bint reduce_single(self, CliffordAlgebraElement f, CliffordAlgebraElement g) except -1
cdef int reduced_gb(self, list G) except -1

# These are the methods that determine the ordering of the monomials.
# These must be implemented in subclasses. Declare them as "inline" there.
cdef Integer bitset_to_int(self, FrozenBitset X) noexcept
cdef FrozenBitset int_to_bitset(self, Integer n) noexcept
cdef Integer bitset_to_int(self, FrozenBitset X)
cdef FrozenBitset int_to_bitset(self, Integer n)

cdef class GroebnerStrategyNegLex(GroebnerStrategy):
pass
Expand Down
36 changes: 18 additions & 18 deletions src/sage/algebras/exterior_algebra_groebner.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ cdef inline long degree(FrozenBitset X) noexcept:
return bitset_len(X._bitset)


cdef inline CliffordAlgebraElement build_monomial(Parent E, FrozenBitset supp) noexcept:
cdef inline CliffordAlgebraElement build_monomial(Parent E, FrozenBitset supp):
"""
Helper function for the fastest way to build a monomial.
"""
Expand Down Expand Up @@ -130,14 +130,14 @@ cdef class GroebnerStrategy:
else:
self.side = 2

cdef inline FrozenBitset leading_support(self, CliffordAlgebraElement f) noexcept:
cdef inline FrozenBitset leading_support(self, CliffordAlgebraElement f):
"""
Return the leading support of the exterior algebra element ``f``.
"""
cdef dict mc = <dict> f._monomial_coefficients
return self.int_to_bitset(max(self.bitset_to_int(k) for k in mc))

cdef inline partial_S_poly_left(self, GBElement f, GBElement g) noexcept:
cdef inline partial_S_poly_left(self, GBElement f, GBElement g):
r"""
Compute one half of the `S`-polynomial for ``f`` and ``g``.
Expand All @@ -154,7 +154,7 @@ cdef class GroebnerStrategy:
ret.elt._monomial_coefficients[k] *= inv
return ret

cdef inline partial_S_poly_right(self, GBElement f, GBElement g) noexcept:
cdef inline partial_S_poly_right(self, GBElement f, GBElement g):
r"""
Compute one half of the `S`-polynomial for ``f`` and ``g``.
Expand All @@ -171,7 +171,7 @@ cdef class GroebnerStrategy:
ret.elt._monomial_coefficients[k] *= inv
return ret

cdef inline GBElement build_elt(self, CliffordAlgebraElement f) noexcept:
cdef inline GBElement build_elt(self, CliffordAlgebraElement f):
"""
Convert ``f`` into a ``GBElement``.
"""
Expand All @@ -181,7 +181,7 @@ cdef class GroebnerStrategy:
cdef Integer r = <Integer> max(self.bitset_to_int(k) for k in mc)
return GBElement(f, self.int_to_bitset(r), r)

cdef inline GBElement prod_GB_term(self, GBElement f, FrozenBitset t) noexcept:
cdef inline GBElement prod_GB_term(self, GBElement f, FrozenBitset t):
"""
Return the GBElement corresponding to ``f * t``.
Expand All @@ -193,7 +193,7 @@ cdef class GroebnerStrategy:
cdef FrozenBitset ls = <FrozenBitset> f.ls._union(t)
return GBElement(<CliffordAlgebraElement> ret, ls, self.bitset_to_int(ls))

cdef inline GBElement prod_term_GB(self, FrozenBitset t, GBElement f) noexcept:
cdef inline GBElement prod_term_GB(self, FrozenBitset t, GBElement f):
"""
Return the GBElement corresponding to ``t * f``.
Expand All @@ -220,7 +220,7 @@ cdef class GroebnerStrategy:

return (<FrozenBitset> f.ls.intersection(g.ls)).isempty()

cdef inline set preprocessing(self, list P, list G) noexcept:
cdef inline set preprocessing(self, list P, list G):
"""
Perform the preprocessing step.
"""
Expand Down Expand Up @@ -266,7 +266,7 @@ cdef class GroebnerStrategy:
break
return L

cdef inline list reduction(self, list P, list G) noexcept:
cdef inline list reduction(self, list P, list G):
"""
Perform the reduction of ``P`` mod ``G`` in ``E``.
"""
Expand Down Expand Up @@ -451,7 +451,7 @@ cdef class GroebnerStrategy:
cdef list G = [self.build_elt(f) for f in self.groebner_basis]
self.reduced_gb(G)

cpdef CliffordAlgebraElement reduce(self, CliffordAlgebraElement f) noexcept:
cpdef CliffordAlgebraElement reduce(self, CliffordAlgebraElement f):
"""
Reduce ``f`` modulo the ideal with Gröbner basis ``G``.
Expand Down Expand Up @@ -533,10 +533,10 @@ cdef class GroebnerStrategy:
iaxpy(-coeff, gp._monomial_coefficients, f._monomial_coefficients)
return was_reduced

cdef Integer bitset_to_int(self, FrozenBitset X) noexcept:
cdef Integer bitset_to_int(self, FrozenBitset X):
raise NotImplementedError

cdef FrozenBitset int_to_bitset(self, Integer n) noexcept:
cdef FrozenBitset int_to_bitset(self, Integer n):
raise NotImplementedError

def sorted_monomials(self, as_dict=False):
Expand Down Expand Up @@ -615,7 +615,7 @@ cdef class GroebnerStrategyNegLex(GroebnerStrategy):
"""
Gröbner basis strategy implementing neglex ordering.
"""
cdef inline Integer bitset_to_int(self, FrozenBitset X) noexcept:
cdef inline Integer bitset_to_int(self, FrozenBitset X):
"""
Convert ``X`` to an :class:`Integer`.
"""
Expand All @@ -626,7 +626,7 @@ cdef class GroebnerStrategyNegLex(GroebnerStrategy):
elt = bitset_next(X._bitset, elt + 1)
return ret

cdef inline FrozenBitset int_to_bitset(self, Integer n) noexcept:
cdef inline FrozenBitset int_to_bitset(self, Integer n):
"""
Convert a nonnegative integer ``n`` to a :class:`FrozenBitset`.
"""
Expand All @@ -646,7 +646,7 @@ cdef class GroebnerStrategyDegRevLex(GroebnerStrategy):
"""
Gröbner basis strategy implementing degree revlex ordering.
"""
cdef inline Integer bitset_to_int(self, FrozenBitset X) noexcept:
cdef inline Integer bitset_to_int(self, FrozenBitset X):
"""
Convert ``X`` to an :class:`Integer`.
"""
Expand All @@ -665,7 +665,7 @@ cdef class GroebnerStrategyDegRevLex(GroebnerStrategy):
elt = bitset_next(X._bitset, elt + 1)
return Integer(sum(n.binomial(i) for i in range(deg+1)) - t - 1)

cdef inline FrozenBitset int_to_bitset(self, Integer n) noexcept:
cdef inline FrozenBitset int_to_bitset(self, Integer n):
"""
Convert a nonnegative integer ``n`` to a :class:`FrozenBitset`.
"""
Expand All @@ -687,7 +687,7 @@ cdef class GroebnerStrategyDegLex(GroebnerStrategy):
"""
Gröbner basis strategy implementing degree lex ordering.
"""
cdef inline Integer bitset_to_int(self, FrozenBitset X) noexcept:
cdef inline Integer bitset_to_int(self, FrozenBitset X):
"""
Convert ``X`` to an :class:`Integer`.
"""
Expand All @@ -706,7 +706,7 @@ cdef class GroebnerStrategyDegLex(GroebnerStrategy):
elt = bitset_next(X._bitset, elt + 1)
return Integer(sum(n.binomial(i) for i in range(deg+1)) - t - 1)

cdef inline FrozenBitset int_to_bitset(self, Integer n) noexcept:
cdef inline FrozenBitset int_to_bitset(self, Integer n):
"""
Convert a nonnegative integer ``n`` to a :class:`FrozenBitset`.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement):
cdef Matrix __matrix
cdef FiniteDimensionalAlgebraElement __inverse

cpdef FiniteDimensionalAlgebraElement unpickle_FiniteDimensionalAlgebraElement(A, vec, mat) noexcept
cpdef FiniteDimensionalAlgebraElement unpickle_FiniteDimensionalAlgebraElement(A, vec, mat)
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ from sage.rings.integer import Integer

from cpython.object cimport PyObject_RichCompare as richcmp

cpdef FiniteDimensionalAlgebraElement unpickle_FiniteDimensionalAlgebraElement(A, vec, mat) noexcept:
cpdef FiniteDimensionalAlgebraElement unpickle_FiniteDimensionalAlgebraElement(A, vec, mat):
"""
Helper for unpickling of finite dimensional algebra elements.
Expand Down Expand Up @@ -365,7 +365,7 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement):
return self._vector.ncols()

# (Rich) comparison
cpdef _richcmp_(self, right, int op) noexcept:
cpdef _richcmp_(self, right, int op):
"""
EXAMPLES::
Expand Down Expand Up @@ -400,7 +400,7 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement):
"""
return richcmp(self._vector, <FiniteDimensionalAlgebraElement>right._vector, op)

cpdef _add_(self, other) noexcept:
cpdef _add_(self, other):
"""
EXAMPLES::
Expand All @@ -411,7 +411,7 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement):
"""
return self._parent.element_class(self._parent, self._vector + <FiniteDimensionalAlgebraElement>other._vector)

cpdef _sub_(self, other) noexcept:
cpdef _sub_(self, other):
"""
EXAMPLES::
Expand All @@ -422,7 +422,7 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement):
"""
return self._parent.element_class(self._parent, self._vector - <FiniteDimensionalAlgebraElement>other._vector)

cpdef _mul_(self, other) noexcept:
cpdef _mul_(self, other):
"""
EXAMPLES::
Expand All @@ -434,7 +434,7 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement):
"""
return self._parent.element_class(self._parent, self._vector * <FiniteDimensionalAlgebraElement>(other)._matrix)

cpdef _lmul_(self, Element other) noexcept:
cpdef _lmul_(self, Element other):
"""
TESTS::
Expand All @@ -450,7 +450,7 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement):
.format(self.parent(), other.parent()))
return self._parent.element_class(self._parent, self._vector * other)

cpdef _rmul_(self, Element other) noexcept:
cpdef _rmul_(self, Element other):
"""
TESTS::
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cdef _fmat(fvars, Nk_ij, one, a, b, c, d, x, y) noexcept
cpdef _backward_subs(factory, bint flatten=*) noexcept
cpdef executor(tuple params) noexcept
cpdef _solve_for_linear_terms(factory, list eqns=*) noexcept
cdef _fmat(fvars, Nk_ij, one, a, b, c, d, x, y)
cpdef _backward_subs(factory, bint flatten=*)
cpdef executor(tuple params)
cpdef _solve_for_linear_terms(factory, list eqns=*)
Loading

0 comments on commit 1d1825f

Please sign in to comment.