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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation with -std=c++17 #37646

Merged
merged 3 commits into from
Mar 31, 2024
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
3 changes: 2 additions & 1 deletion src/sage/modular/arithgroup/farey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <sstream>
#include <algorithm>
#include <cassert>
#include <functional>

#include <gmpxx.h>
#include <Python.h>
Expand Down Expand Up @@ -737,7 +738,7 @@ size_t FareySymbol::nu3() const {
size_t FareySymbol::rank_pi() const {
if( index() == 2 ) return 1;
return count_if(pairing.begin(), pairing.end(),
bind2nd(greater<int>(), 0))/2;
bind(greater<int>(), placeholders::_1, 0))/2;
}

size_t FareySymbol::number_of_cusps() const {
Expand Down
2 changes: 2 additions & 0 deletions src/sage/modular/arithgroup/farey_symbol.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# distutils: sources = sage/modular/arithgroup/sl2z.cpp sage/modular/arithgroup/farey.cpp
# distutils: language = c++
# distutils: extra_compile_args = -std=c++11
Feyorsh marked this conversation as resolved.
Show resolved Hide resolved
# sage.doctest: needs sage.libs.pari
r"""
Farey symbol for arithmetic subgroups of `\PSL_2(\ZZ)`
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/polynomial/hilbert.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ cdef inline list interred(list L) noexcept:
# that appears later in L.
if not L:
return []
L.sort(key=ETuple.unweighted_degree)
L.sort(key=ETuple._unweighted_degree)
cdef size_t i
cdef ETuple m
cdef list result = [<ETuple> PyList_GET_ITEM(L, 0)]
Expand Down
2 changes: 2 additions & 0 deletions src/sage/rings/polynomial/polydict.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ cdef class ETuple:
cdef ETuple _new(self) noexcept
cdef int get_exp(self, size_t i) noexcept

# need a cdef version for function pointers
cdef int _unweighted_degree(self) except *
cpdef int unweighted_degree(self) except *
cpdef int weighted_degree(self, tuple w) except *
cpdef int unweighted_quotient_degree(self, ETuple other) except *
Expand Down
16 changes: 15 additions & 1 deletion src/sage/rings/polynomial/polydict.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,7 @@ cdef class ETuple:

# additional methods

cpdef int unweighted_degree(self) except *:
cdef int _unweighted_degree(self) except *:
r"""
Return the sum of entries.

Expand All @@ -1863,6 +1863,20 @@ cdef class ETuple:
degree += self._data[2 * i + 1]
return degree

cpdef int unweighted_degree(self) except *:
r"""
Return the sum of entries.

EXAMPLES::

sage: from sage.rings.polynomial.polydict import ETuple
sage: ETuple([1, 1, 0, 2, 0]).unweighted_degree()
4
sage: ETuple([-1, 1]).unweighted_degree()
0
"""
return self._unweighted_degree()

Feyorsh marked this conversation as resolved.
Show resolved Hide resolved
@cython.boundscheck(False)
@cython.wraparound(False)
cpdef int weighted_degree(self, tuple w) except *:
Expand Down
Loading