Skip to content

Commit bc2e588

Browse files
author
Release Manager
committed
gh-36463: remove unused variables in pyx files in groups/ This removes unused variables in pyx files in the groups folder. Found using cython-lint ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. URL: #36463 Reported by: Frédéric Chapoton Reviewer(s): Kwankyu Lee
2 parents 8f337cf + 1ae2c55 commit bc2e588

File tree

4 files changed

+19
-43
lines changed

4 files changed

+19
-43
lines changed

src/sage/groups/perm_gps/partn_ref/canonical_augmentation.pyx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,9 @@ cdef void *canonical_generator_next(void *can_gen_data, int *degree, bint *mem_e
183183
cdef void *next_candidate
184184
cdef void *parent_cand
185185
cdef void *aug
186-
cdef int i, next_cand_deg, parent_cand_deg
187-
cdef int *isom
186+
cdef int next_cand_deg, parent_cand_deg
188187
cdef PartitionStack *part
189188
cdef bint augmentation_is_canonical
190-
cdef aut_gp_and_can_lab *output
191-
cdef agcl_work_space *agcl_ws
192-
cdef dc_work_space *dc_ws
193189

194190
if cgd.level == 0:
195191
if cgd.mem_err:
@@ -344,15 +340,14 @@ cdef canonical_generator_data *allocate_cgd(int max_depth, int degree):
344340
cgd.degree_stack[0] = degree
345341
return cgd
346342

343+
347344
cdef void deallocate_cgd(canonical_generator_data *cgd):
348345
r"""
349346
Deallocate the data part of the canonical generation iterator struct.
350347
"""
351348
if cgd is NULL:
352349
return
353350
cdef int i
354-
cdef void *thingy
355-
cdef void (*clearer)(void*)
356351
for i from 0 <= i < cgd.allocd_levels:
357352
if cgd.agcl_work_spaces[i] is not NULL:
358353
deallocate_agcl_work_space(cgd.agcl_work_spaces[i])

src/sage/groups/perm_gps/partn_ref/data_structures.pyx

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ cdef inline OrbitPartition *OP_new(int n):
4545
Allocate and return a pointer to a new OrbitPartition of degree n. Returns a
4646
null pointer in the case of an allocation failure.
4747
"""
48-
cdef int i
4948
cdef OrbitPartition *OP = <OrbitPartition *> \
5049
sig_malloc(sizeof(OrbitPartition))
5150
cdef int *int_array = <int *> sig_malloc( 4*n * sizeof(int) )
@@ -185,7 +184,6 @@ cdef inline PartitionStack *PS_new(int n, bint unit_partition):
185184
Allocate and return a pointer to a new PartitionStack of degree n. Returns a
186185
null pointer in the case of an allocation failure.
187186
"""
188-
cdef int i
189187
cdef PartitionStack *PS = <PartitionStack *> \
190188
sig_malloc(sizeof(PartitionStack))
191189
cdef int *int_array = <int *> sig_malloc( 2*n * sizeof(int) )
@@ -210,15 +208,15 @@ cdef void PS_unit_partition(PartitionStack *PS):
210208
for i in range(n - 1):
211209
PS.entries[i] = i
212210
PS.levels[i] = n
213-
PS.entries[n-1] = n-1
211+
PS.entries[n-1] = n - 1
214212
PS.levels[n-1] = -1
215213

216214
cdef inline PartitionStack *PS_copy(PartitionStack *PS):
217215
"""
218216
Allocate and return a pointer to a copy of PartitionStack PS. Returns a null
219217
pointer in the case of an allocation failure.
220218
"""
221-
cdef int i, n = PS.degree
219+
cdef int n = PS.degree
222220

223221
cdef PartitionStack *PS2 = <PartitionStack *> \
224222
sig_malloc(sizeof(PartitionStack))
@@ -327,7 +325,6 @@ cdef int PS_all_new_cells(PartitionStack *PS, bitset_t** nonsingletons_ptr):
327325
Return the number of rows of ``nonsingletons_ptr``.
328326
"""
329327
cdef int beg=0, end, n = PS.degree, count=0, i, n_1 = n-1
330-
cdef bint non_unit_partition = False
331328
cdef bitset_t scratch
332329
bitset_init(scratch, n)
333330
cdef bitset_t* nonsingletons = nonsingletons_ptr[0]
@@ -561,10 +558,6 @@ cdef StabilizerChain *SC_new(int n, bint init_gens=True):
561558
cdef int i
562559
cdef StabilizerChain *SC = <StabilizerChain *> \
563560
sig_calloc(1, sizeof(StabilizerChain))
564-
cdef int *array1
565-
cdef int *array2
566-
cdef int *array3
567-
cdef bint mem_err = 0
568561
if SC is NULL:
569562
return NULL
570563
SC.degree = n
@@ -762,7 +755,6 @@ cdef int SC_realloc_bitsets(StabilizerChain *SC, unsigned long size):
762755
cdef unsigned long new_size = size_old
763756
while new_size < size:
764757
new_size *= 2
765-
cdef unsigned long limbs_old = SC.gen_used.limbs
766758
cdef long limbs = (new_size - 1)/(8*sizeof(unsigned long)) + 1
767759
cdef mp_limb_t *tmp = <mp_limb_t*> sig_realloc(SC.gen_used.bits, limbs * sizeof(mp_limb_t))
768760
if tmp is not NULL:
@@ -866,7 +858,7 @@ cdef StabilizerChain *SC_new_base(StabilizerChain *SC, int *base, int base_len):
866858
return NEW
867859

868860
cdef int SC_new_base_nomalloc(StabilizerChain *SC_dest, StabilizerChain *SC, int *base, int base_len):
869-
cdef int i, n = SC.degree
861+
cdef int i
870862
SC_dest.base_size = 0
871863
for i in range(base_len):
872864
SC_add_base_point(SC_dest, base[i])
@@ -937,7 +929,7 @@ cdef StabilizerChain *SC_insert_base_point(StabilizerChain *SC, int level, int p
937929
return NEW
938930

939931
cdef int SC_insert_base_point_nomalloc(StabilizerChain *SC_dest, StabilizerChain *SC, int level, int p):
940-
cdef int i, b, n = SC.degree
932+
cdef int i, b
941933
SC_copy_nomalloc(SC_dest, SC, level)
942934
SC_add_base_point(SC_dest, p)
943935
for i in range(level, SC.base_size):
@@ -956,7 +948,7 @@ cdef int SC_re_tree(StabilizerChain *SC, int level, int *perm, int x):
956948
"""
957949
cdef int *gen
958950
cdef int *gen_inv
959-
cdef int i, b, gen_index, error, n = SC.degree
951+
cdef int i, b, gen_index, n = SC.degree
960952

961953
# make sure we have room for the new generator:
962954
if SC.array_size[level] == SC.num_gens[level]:
@@ -1027,7 +1019,6 @@ cdef int SC_sift(StabilizerChain *SC, int level, int x, int *gens, int num_gens,
10271019
cdef int y, b = SC.base_orbits[level][0]
10281020
cdef int *perm
10291021
cdef int *perm_rep_inv = temp
1030-
cdef int j
10311022
for i from 0 <= i < num_gens:
10321023
perm = new_gens + n*i # this is now rs
10331024
y = perm[b]
@@ -1039,7 +1030,6 @@ cdef int SC_sift(StabilizerChain *SC, int level, int x, int *gens, int num_gens,
10391030
cdef int SC_insert_and_sift(StabilizerChain *SC, int level, int *pi, int num_perms, bint sift):
10401031
cdef int i, j, b, n = SC.degree
10411032
cdef int perm_gen_index
1042-
cdef int max_orbit_size, max_orbit_place
10431033
if sift:
10441034
if SC_realloc_bitsets(SC, num_perms):
10451035
return 1
@@ -1065,13 +1055,11 @@ cdef int SC_insert_and_sift(StabilizerChain *SC, int level, int *pi, int num_per
10651055

10661056
# Record the old orbit elements and the old generators (see sifting phase)
10671057
cdef int old_num_gens = SC.num_gens[level]
1068-
cdef int old_num_points = SC.orbit_sizes[level]
10691058

10701059
# Add new points to the tree:
10711060
cdef int x
10721061
cdef int *perm
10731062
cdef int start_over = 1
1074-
cdef int error
10751063
cdef int re_treed = 0
10761064
while start_over:
10771065
start_over = 0

src/sage/groups/perm_gps/partn_ref/refinement_binary.pyx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,8 @@ cdef class LinearBinaryCodeStruct(BinaryCodeStruct):
235235
sage: B = LinearBinaryCodeStruct(M)
236236
sage: B.automorphism_group()[1]
237237
17868913969917295853568000000
238-
239238
"""
240-
cdef int i, n = self.degree
239+
cdef int n = self.degree
241240
cdef PartitionStack *part
242241
if partition is None:
243242
part = PS_new(n, 1)
@@ -650,7 +649,7 @@ cdef int refine_by_bip_degree(PartitionStack *col_ps, void *S, int *cells_to_ref
650649
"""
651650
cdef BinaryCodeStruct BCS = <BinaryCodeStruct> S
652651
cdef int current_cell_against = 0
653-
cdef int current_cell, i, r, j
652+
cdef int current_cell, i, r
654653
cdef int first_largest_subcell
655654
cdef int invariant = 0
656655
cdef PartitionStack *word_ps = BCS.word_ps
@@ -970,7 +969,7 @@ cdef inline int word_degree(PartitionStack *word_ps, BinaryCodeStruct BCS, int e
970969
of PS
971970
"""
972971
cdef bitset_t cell, word
973-
cdef int i, h
972+
cdef int h
974973
bitset_init(cell, BCS.degree)
975974
bitset_zero(cell)
976975
bitset_init(word, BCS.degree)
@@ -1001,7 +1000,7 @@ cdef inline int col_degree(PartitionStack *col_ps, BinaryCodeStruct BCS, int ent
10011000
"""
10021001
cdef bitset_t word
10031002
bitset_init(word, BCS.degree)
1004-
cdef int degree = 0, word_basis, i, b
1003+
cdef int degree = 0
10051004
entry = col_ps.entries[entry]
10061005
while True:
10071006
BCS.ith_word(BCS, word_ps.entries[cell_index], word)
@@ -1017,15 +1016,14 @@ cdef inline int sort_by_function_codes(PartitionStack *PS, int start, int *degre
10171016
A simple counting sort, given the degrees of vertices to a certain cell.
10181017
10191018
INPUT:
1020-
PS -- the partition stack to be checked
1021-
start -- beginning index of the cell to be sorted
1022-
degrees -- the values to be sorted by
1023-
count, count_max, output -- scratch space
10241019
1020+
- PS -- the partition stack to be checked
1021+
- start -- beginning index of the cell to be sorted
1022+
- degrees -- the values to be sorted by
1023+
- count, count_max, output -- scratch space
10251024
"""
1026-
cdef int n = PS.degree
10271025
cdef int i, j, max, max_location
1028-
for j from 0 <= j < count_max:
1026+
for j in range(count_max):
10291027
counts[j] = 0
10301028
i = 0
10311029
while PS.levels[i+start] > PS.depth:

src/sage/groups/perm_gps/partn_ref/refinement_graphs.pyx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def isomorphic(G1, G2, partn, ordering2, dig, use_indicator_function, sparse=Fal
6565
cdef GraphStruct GS1 = GraphStruct()
6666
cdef GraphStruct GS2 = GraphStruct()
6767
cdef GraphStruct GS
68-
cdef int i, j, k, n = -1, cell_len
68+
cdef int i, j, n = -1
6969
cdef list partition, cell
7070
cdef bint loops = 0
7171

@@ -131,7 +131,6 @@ def isomorphic(G1, G2, partn, ordering2, dig, use_indicator_function, sparse=Fal
131131
raise TypeError("G must be a Sage graph")
132132
if first:
133133
frm1 = frm
134-
to1 = to
135134
else:
136135
frm2 = frm
137136
to2 = to
@@ -464,7 +463,6 @@ def search_tree(G_in, partition, lab=True, dig=False, dict_rep=False, certificat
464463
sig_free(GS.scratch)
465464
raise MemoryError
466465

467-
lab_new = lab or certificate
468466
output = get_aut_gp_and_can_lab(<void *>GS, part, G.num_verts, &all_children_are_equivalent, &refine_by_degree, &compare_graphs, lab, NULL, NULL, NULL)
469467
sig_free( GS.scratch )
470468
# prepare output
@@ -693,7 +691,6 @@ cdef bint all_children_are_equivalent(PartitionStack *PS, void *S):
693691
cdef GraphStruct GS = <GraphStruct> S
694692
if GS.directed or GS.loops:
695693
return 0
696-
cdef CGraph G = GS.G
697694
cdef int i, n = PS.degree
698695
cdef bint in_cell = 0
699696
cdef int nontrivial_cells = 0
@@ -1147,7 +1144,7 @@ cdef void *apply_dg_edge_aug(void *parent, void *aug, void *child, int *degree,
11471144
cdef GraphStruct GS_child = <GraphStruct> child, GS_par = <GraphStruct> parent
11481145
cdef DenseGraph DG = <DenseGraph> GS_child.G, DG_par = <DenseGraph> GS_par.G
11491146
cdef subset *edge = <subset *> aug
1150-
cdef int u, v, n = DG_par.num_verts
1147+
cdef int u, v
11511148

11521149
# copy DG_par edges to DG
11531150
copy_dense_graph(DG, DG_par)
@@ -1353,7 +1350,6 @@ def generate_dense_graphs_edge_addition(int n, bint loops, G=None, depth=None,
13531350

13541351
cdef list out_list
13551352
cdef void *thing
1356-
cdef GraphStruct thing_gs
13571353
cdef Integer number
13581354
cdef bint mem_err = 0
13591355
if construct:
@@ -1476,7 +1472,7 @@ cdef void *canonical_dg_vert_parent(void *child, void *parent, int *permutation,
14761472
"""
14771473
cdef GraphStruct GS_par = <GraphStruct> parent, GS = <GraphStruct> child
14781474
cdef DenseGraph DG_par = <DenseGraph> GS_par.G, DG = <DenseGraph> GS.G
1479-
cdef int u, v, n = DG_par.num_verts
1475+
cdef int u, n = DG_par.num_verts
14801476
cdef int *scratch = GS.scratch
14811477

14821478
# copy DG edges to DG_par
@@ -1630,7 +1626,6 @@ def generate_dense_graphs_vert_addition(int n, base_G=None,
16301626

16311627
cdef list out_list
16321628
cdef void *thing
1633-
cdef GraphStruct thing_gs
16341629
cdef Integer number
16351630
cdef bint mem_err = 0
16361631
if construct:

0 commit comments

Comments
 (0)