Skip to content
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
7 changes: 4 additions & 3 deletions src/sage/coding/binary_code.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ cdef int *hamming_weights() noexcept:
ham_wts[i] = ham_wts[i & 255] + ham_wts[(i>>8) & 255]
return ham_wts


def weight_dist(M):
"""
Computes the weight distribution of the row space of `M`.
Expand Down Expand Up @@ -155,6 +156,7 @@ def weight_dist(M):
sig_free(basis)
return L


def test_word_perms(t_limit=5.0):
r"""
Test the :class:`WordPermutation` structs for at least ``t_limit`` seconds.
Expand Down Expand Up @@ -279,6 +281,7 @@ def test_word_perms(t_limit=5.0):
dealloc_word_perm(i)
sig_free(arr)


cdef WordPermutation *create_word_perm(object list_perm) noexcept:
r"""
Create a word permutation from a Python list permutation L, i.e. such that
Expand Down Expand Up @@ -574,6 +577,7 @@ def test_expand_to_ortho_basis(B=None):
print(''.join(reversed(Integer(output[i]).binary().zfill(C.ncols))))
sig_free(output)


cdef codeword *expand_to_ortho_basis(BinaryCode B, int n) noexcept:
r"""
INPUT:
Expand Down Expand Up @@ -4069,7 +4073,6 @@ cdef class BinaryCodeClassifier:

output = []


for i from 0 <= i < len(aut_gp_gens):
parent_generators[i] = create_word_perm(aut_gp_gens[i] + list(range(B.ncols, n)))

Expand All @@ -4095,7 +4098,6 @@ cdef class BinaryCodeClassifier:
for temp from 0 <= temp < ((<codeword>1) << orb_chx_size):
orbit_checks[temp] = 0


combo = 0
parity = 0
gate = (<codeword>1 << B.nrows) - 1
Expand Down Expand Up @@ -4212,7 +4214,6 @@ cdef class BinaryCodeClassifier:
temp = (temp >> B.nrows) & k_gate
orbit_checks[temp >> log_2_radix] |= ((<codeword>1) << (temp & radix_gate))


parity ^= 1
i = 0
if not parity:
Expand Down
3 changes: 1 addition & 2 deletions src/sage/coding/codecan/autgroup_can_label.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def _cyclic_shift(n, p):
x[p[len(p) - 1]] = p[0] + 1
return Permutation(x)


class LinearCodeAutGroupCanLabel:
r"""
Canonical representatives and automorphism group computation for linear
Expand Down Expand Up @@ -378,7 +379,6 @@ class LinearCodeAutGroupCanLabel:
normalization_inverse, z, [pos2P[x] for x in z], zero_column_case=True)
self._full_autom_order *= a


for i in range(len(col2P)):
if len(col2P[i]) > 1:
A, a = self._compute_trivial_automs(normalization,
Expand Down Expand Up @@ -583,7 +583,6 @@ class LinearCodeAutGroupCanLabel:
"""
return self._full_autom_order


def get_PGammaL_gens(self):
r"""
Return the set of generators translated to the group `P\Gamma L(k,q)`.
Expand Down
5 changes: 0 additions & 5 deletions src/sage/coding/codecan/codecan.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ cdef class InnerGroup:
elif algorithm == "linear":
self.frob_pow = 0


self.compute_transporter = False
if "transporter" in kwds:
self.transporter = kwds["transporter"]
Expand Down Expand Up @@ -641,7 +640,6 @@ cdef class PartitionRefinementLinearCode(PartitionRefinement_generic):
self._autom_group_generators.append(transp_inv * x * self._transporter)
self._inner_group_stabilizer_order = (len(F) - 1) ** len(P)


if remaining_inner_group.get_frob_pow() > 0:
x = S(autom=F.hom([F.primitive_element() ** (remaining_inner_group.get_frob_pow() * F.characteristic())]))
self._autom_group_generators.append(transp_inv * x * self._transporter)
Expand Down Expand Up @@ -900,7 +898,6 @@ cdef class PartitionRefinementLinearCode(PartitionRefinement_generic):
return True
return True


cdef bint _inner_min_refine(self, bint *inner_stab_changed, bint *changed_partition) noexcept:
"""
Refine the partition ``self.part`` by computing the orbit (respectively
Expand Down Expand Up @@ -1013,8 +1010,6 @@ cdef class PartitionRefinementLinearCode(PartitionRefinement_generic):
- ``False`` only if the image under this homomorphism of group actions
compares larger than the image of the candidate for the canonical form.
"""


self._hyp_part.depth += 1
PS_clear(self._hyp_part)
cdef bitset_t *nonsingletons = NULL
Expand Down
7 changes: 4 additions & 3 deletions src/sage/coding/kasami_codes.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,23 @@ AUTHORS:
- Ivo Maffei (2020-07-09): initial version
"""

#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2020 Ivo Maffei <ivomaffei@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.rings.finite_rings.finite_field_constructor import GF
from sage.matrix.constructor import matrix
from sage.coding.linear_code import (AbstractLinearCode,
LinearCodeGeneratorMatrixEncoder)
from sage.arith.misc import is_prime_power, gcd


class KasamiCode(AbstractLinearCode):
r"""
Representation of a Kasami Code.
Expand Down
12 changes: 3 additions & 9 deletions src/sage/modules/free_module_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1930,7 +1930,6 @@ cdef class FreeModuleElement(Vector): # abstract base class
assert value.parent() is self.coordinate_ring()
self.set_unsafe(i, value)


def __invert__(self):
"""
Invert v, which makes no sense, and is hence is not implemented.
Expand Down Expand Up @@ -2408,7 +2407,6 @@ cdef class FreeModuleElement(Vector): # abstract base class
else:
start = list(start)


if plot_type == 'arrow' or plot_type == 'point':
dimension = len(coords)
if dimension == 3:
Expand Down Expand Up @@ -3117,7 +3115,6 @@ cdef class FreeModuleElement(Vector): # abstract base class
"""
return self


def monic(self):
"""
Return this vector divided through by the first nonzero entry of
Expand Down Expand Up @@ -3852,7 +3849,6 @@ cdef class FreeModuleElement(Vector): # abstract base class
else:
return self.parent().ambient_module().sparse_module()(self.list())


def apply_map(self, phi, R=None, sparse=None):
"""
Apply the given map phi (an arbitrary Python function or callable
Expand Down Expand Up @@ -3998,7 +3994,6 @@ cdef class FreeModuleElement(Vector): # abstract base class
else:
return vector(R, v, sparse=sparse)


def _derivative(self, var=None):
"""
Differentiate with respect to var by differentiating each element
Expand Down Expand Up @@ -4101,8 +4096,7 @@ cdef class FreeModuleElement(Vector): # abstract base class
from sage.misc.functional import integral
return self.apply_map(lambda x: integral(x,*args, **kwds))

integrate=integral

integrate = integral

def nintegral(self, *args, **kwds):
"""
Expand Down Expand Up @@ -4231,6 +4225,7 @@ cdef class FreeModuleElement(Vector): # abstract base class
return vector(ring, coeffs)
return vector(coeffs)


#############################################
# Generic dense element
#############################################
Expand Down Expand Up @@ -4283,6 +4278,7 @@ def make_FreeModuleElement_generic_dense_v1(parent, entries, degree, is_mutable)
v._is_immutable = not is_mutable
return v


cdef class FreeModuleElement_generic_dense(FreeModuleElement):
"""
A generic dense element of a free module.
Expand Down Expand Up @@ -4603,7 +4599,6 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement):
"""
self._entries[i] = value


def list(self, copy=True):
"""
Return list of elements of self.
Expand Down Expand Up @@ -5253,7 +5248,6 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement):
else:
self._entries.pop(i, None)


def denominator(self):
"""
Return the least common multiple of the denominators of the
Expand Down
4 changes: 0 additions & 4 deletions src/sage/modules/vector_double_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ cdef class Vector_double_dense(Vector_numpy_dense):

return self._new(self._vector_numpy*self._python_dtype(right))


def inv_fft(self,algorithm="radix2", inplace=False):
"""
This performs the inverse fast Fourier transform on the vector.
Expand Down Expand Up @@ -310,7 +309,6 @@ cdef class Vector_double_dense(Vector_numpy_dense):
"""
return self.change_ring(CDF)


def zero_at(self, eps):
r"""
Returns a copy with small entries replaced by zeros.
Expand Down Expand Up @@ -360,7 +358,6 @@ cdef class Vector_double_dense(Vector_numpy_dense):
v = self._new(out)
return v


def norm(self, p=2):
r"""
Returns the norm (or related computations) of the vector.
Expand Down Expand Up @@ -546,7 +543,6 @@ cdef class Vector_double_dense(Vector_numpy_dense):
else:
return self._sage_dtype(numpy.std(self._vector_numpy, ddof=0))


def stats_kurtosis(self):
"""
Compute the kurtosis of a dataset.
Expand Down
1 change: 0 additions & 1 deletion src/sage/modules/vector_integer_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement):
mpz_add(z._entries[i], self._entries[i], r._entries[i])
return z


cpdef _sub_(self, right):
cdef Vector_integer_dense z, r
r = right
Expand Down
1 change: 0 additions & 1 deletion src/sage/modules/vector_integer_sparse.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ cdef int mpz_vector_set_entry(mpz_vector* v, Py_ssize_t n, mpz_t x) except -1:
sig_free(pos)



cdef mpz_t mpz_set_tmp
mpz_init(mpz_set_tmp)
cdef int mpz_vector_set_entry_str(mpz_vector* v, Py_ssize_t n, char *x_str) except -1:
Expand Down
2 changes: 0 additions & 2 deletions src/sage/modules/vector_mod2_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement):
"""
mzd_write_bit(self._entries, 0, i, value)


def __reduce__(self):
"""
EXAMPLES::
Expand Down Expand Up @@ -348,7 +347,6 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement):
res += Integer(row[i]).popcount()
return res


cpdef _dot_product_(self, Vector right):
"""
EXAMPLES::
Expand Down
2 changes: 0 additions & 2 deletions src/sage/modules/vector_modn_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement):
"""
self._entries[i] = ivalue(<IntegerMod_abstract>value)


def __reduce__(self):
return unpickle_v1, (self._parent, self.list(), self._degree,
self._p, not self._is_immutable)
Expand All @@ -285,7 +284,6 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement):
z._entries[i] = (self._entries[i] + r._entries[i]) % self._p
return z


cpdef _sub_(self, right):
cdef Vector_modn_dense z, r
r = right
Expand Down
1 change: 0 additions & 1 deletion src/sage/modules/vector_rational_sparse.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ cdef int mpq_vector_set_entry(mpq_vector* v, Py_ssize_t n, mpq_t x) except -1:
sig_free(pos)



cdef mpq_t mpq_set_tmp
mpq_init(mpq_set_tmp)
cdef int mpq_vector_set_entry_str(mpq_vector* v, Py_ssize_t n, char *x_str) except -1:
Expand Down
1 change: 0 additions & 1 deletion src/sage/modules/vector_real_double_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ cdef class Vector_real_double_dense(Vector_double_dense):
import scipy.stats
return self._sage_dtype(scipy.stats.skew(self._vector_numpy))


def __reduce__(self):
"""
Pickling
Expand Down
1 change: 1 addition & 0 deletions src/sage/modules/with_basis/indexed_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,7 @@ def _unpickle_element(C, d):
"""
return C._from_dict(d, coerce=False, remove_zeros=False)


# Handle old CombinatorialFreeModuleElement pickles, see Issue #22632
from sage.misc.persist import register_unpickle_override
register_unpickle_override("sage.combinat.free_module",
Expand Down