passagemath-graphs 10.5.43__cp311-cp311-macosx_14_0_arm64.whl → 10.6.1rc2__cp311-cp311-macosx_14_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. {passagemath_graphs-10.5.43.dist-info → passagemath_graphs-10.6.1rc2.dist-info}/METADATA +5 -6
  2. {passagemath_graphs-10.5.43.dist-info → passagemath_graphs-10.6.1rc2.dist-info}/RECORD +132 -130
  3. sage/combinat/abstract_tree.py +188 -17
  4. sage/combinat/cluster_algebra_quiver/interact.py +1 -2
  5. sage/combinat/cluster_algebra_quiver/mutation_type.py +518 -519
  6. sage/combinat/cluster_algebra_quiver/quiver.py +233 -205
  7. sage/combinat/designs/covering_design.py +2 -6
  8. sage/combinat/designs/database.py +11 -10
  9. sage/combinat/designs/designs_pyx.cpython-311-darwin.so +0 -0
  10. sage/combinat/designs/designs_pyx.pyx +2 -2
  11. sage/combinat/designs/evenly_distributed_sets.cpython-311-darwin.so +0 -0
  12. sage/combinat/designs/evenly_distributed_sets.pyx +4 -4
  13. sage/combinat/designs/gen_quadrangles_with_spread.cpython-311-darwin.so +0 -0
  14. sage/combinat/designs/latin_squares.py +53 -20
  15. sage/combinat/designs/orthogonal_arrays.py +2 -1
  16. sage/combinat/designs/orthogonal_arrays_find_recursive.cpython-311-darwin.so +0 -0
  17. sage/combinat/designs/orthogonal_arrays_find_recursive.pyx +22 -21
  18. sage/combinat/designs/resolvable_bibd.py +191 -157
  19. sage/combinat/designs/subhypergraph_search.cpython-311-darwin.so +0 -0
  20. sage/combinat/designs/subhypergraph_search.pyx +4 -4
  21. sage/combinat/designs/twographs.py +2 -2
  22. sage/combinat/finite_state_machine.py +6 -6
  23. sage/combinat/posets/bubble_shuffle.py +247 -0
  24. sage/combinat/posets/d_complete.py +3 -3
  25. sage/combinat/posets/elements.py +3 -3
  26. sage/combinat/posets/hasse_cython.cpython-311-darwin.so +0 -0
  27. sage/combinat/posets/hasse_cython.pyx +1 -1
  28. sage/combinat/posets/hasse_diagram.py +16 -22
  29. sage/combinat/posets/hochschild_lattice.py +158 -0
  30. sage/combinat/posets/incidence_algebras.py +14 -16
  31. sage/combinat/posets/lattices.py +51 -53
  32. sage/combinat/posets/linear_extension_iterator.cpython-311-darwin.so +0 -0
  33. sage/combinat/posets/linear_extensions.py +10 -12
  34. sage/combinat/posets/moebius_algebra.py +4 -4
  35. sage/combinat/posets/poset_examples.py +70 -23
  36. sage/combinat/posets/posets.py +294 -103
  37. sage/databases/knotinfo_db.py +2 -1
  38. sage/graphs/asteroidal_triples.cpython-311-darwin.so +0 -0
  39. sage/graphs/asteroidal_triples.pyx +24 -3
  40. sage/graphs/base/boost_graph.cpython-311-darwin.so +0 -0
  41. sage/graphs/base/boost_graph.pxd +3 -3
  42. sage/graphs/base/c_graph.cpython-311-darwin.so +0 -0
  43. sage/graphs/base/c_graph.pyx +1 -1
  44. sage/graphs/base/dense_graph.cpython-311-darwin.so +0 -0
  45. sage/graphs/base/dense_graph.pxd +5 -3
  46. sage/graphs/base/dense_graph.pyx +44 -0
  47. sage/graphs/base/graph_backends.cpython-311-darwin.so +0 -0
  48. sage/graphs/base/sparse_graph.cpython-311-darwin.so +0 -0
  49. sage/graphs/base/static_dense_graph.cpython-311-darwin.so +0 -0
  50. sage/graphs/base/static_sparse_backend.cpython-311-darwin.so +0 -0
  51. sage/graphs/base/static_sparse_backend.pyx +8 -5
  52. sage/graphs/base/static_sparse_graph.cpython-311-darwin.so +0 -0
  53. sage/graphs/base/static_sparse_graph.pyx +86 -15
  54. sage/graphs/bipartite_graph.py +59 -36
  55. sage/graphs/centrality.cpython-311-darwin.so +0 -0
  56. sage/graphs/centrality.pyx +82 -9
  57. sage/graphs/cographs.py +1 -1
  58. sage/graphs/comparability.cpython-311-darwin.so +0 -0
  59. sage/graphs/comparability.pyx +64 -26
  60. sage/graphs/connectivity.cpython-311-darwin.so +0 -0
  61. sage/graphs/convexity_properties.cpython-311-darwin.so +0 -0
  62. sage/graphs/convexity_properties.pyx +52 -9
  63. sage/graphs/digraph.py +439 -95
  64. sage/graphs/digraph_generators.py +174 -102
  65. sage/graphs/distances_all_pairs.cpython-311-darwin.so +0 -0
  66. sage/graphs/dot2tex_utils.py +1 -1
  67. sage/graphs/edge_connectivity.cpython-311-darwin.so +0 -0
  68. sage/graphs/generators/basic.py +1 -1
  69. sage/graphs/generators/distance_regular.cpython-311-darwin.so +0 -0
  70. sage/graphs/generators/distance_regular.pyx +1 -1
  71. sage/graphs/generators/families.py +37 -27
  72. sage/graphs/generators/random.py +2 -2
  73. sage/graphs/generators/smallgraphs.py +3 -3
  74. sage/graphs/generic_graph.py +558 -86
  75. sage/graphs/generic_graph_pyx.cpython-311-darwin.so +0 -0
  76. sage/graphs/generic_graph_pyx.pyx +58 -11
  77. sage/graphs/genus.cpython-311-darwin.so +0 -0
  78. sage/graphs/genus.pyx +3 -4
  79. sage/graphs/graph.py +291 -8
  80. sage/graphs/graph_coloring.cpython-311-darwin.so +0 -0
  81. sage/graphs/graph_database.py +67 -12
  82. sage/graphs/graph_decompositions/bandwidth.cpython-311-darwin.so +0 -0
  83. sage/graphs/graph_decompositions/clique_separators.cpython-311-darwin.so +0 -0
  84. sage/graphs/graph_decompositions/clique_separators.pyx +24 -3
  85. sage/graphs/graph_decompositions/cutwidth.cpython-311-darwin.so +0 -0
  86. sage/graphs/graph_decompositions/fast_digraph.cpython-311-darwin.so +0 -0
  87. sage/graphs/graph_decompositions/fast_digraph.pyx +1 -1
  88. sage/graphs/graph_decompositions/graph_products.cpython-311-darwin.so +0 -0
  89. sage/graphs/graph_decompositions/graph_products.pyx +67 -21
  90. sage/graphs/graph_decompositions/modular_decomposition.cpython-311-darwin.so +0 -0
  91. sage/graphs/graph_decompositions/slice_decomposition.cpython-311-darwin.so +0 -0
  92. sage/graphs/graph_decompositions/slice_decomposition.pyx +34 -8
  93. sage/graphs/graph_decompositions/tree_decomposition.cpython-311-darwin.so +0 -0
  94. sage/graphs/graph_decompositions/vertex_separation.cpython-311-darwin.so +0 -0
  95. sage/graphs/graph_generators.py +45 -32
  96. sage/graphs/graph_generators_pyx.cpython-311-darwin.so +0 -0
  97. sage/graphs/graph_generators_pyx.pyx +15 -15
  98. sage/graphs/graph_latex.py +1 -1
  99. sage/graphs/graph_list.py +52 -9
  100. sage/graphs/graph_plot.py +7 -0
  101. sage/graphs/hyperbolicity.cpython-311-darwin.so +0 -0
  102. sage/graphs/hyperbolicity.pyx +2 -0
  103. sage/graphs/independent_sets.cpython-311-darwin.so +0 -0
  104. sage/graphs/isoperimetric_inequalities.cpython-311-darwin.so +0 -0
  105. sage/graphs/isoperimetric_inequalities.pyx +42 -6
  106. sage/graphs/line_graph.cpython-311-darwin.so +0 -0
  107. sage/graphs/line_graph.pyx +153 -37
  108. sage/graphs/matching_covered_graph.py +84 -60
  109. sage/graphs/orientations.py +3 -18
  110. sage/graphs/path_enumeration.cpython-311-darwin.so +0 -0
  111. sage/graphs/path_enumeration.pyx +2 -2
  112. sage/graphs/spanning_tree.cpython-311-darwin.so +0 -0
  113. sage/graphs/strongly_regular_db.cpython-311-darwin.so +0 -0
  114. sage/graphs/strongly_regular_db.pyx +15 -15
  115. sage/graphs/traversals.cpython-311-darwin.so +0 -0
  116. sage/graphs/traversals.pyx +13 -12
  117. sage/graphs/trees.cpython-311-darwin.so +0 -0
  118. sage/graphs/tutte_polynomial.py +1 -1
  119. sage/graphs/views.cpython-311-darwin.so +0 -0
  120. sage/graphs/weakly_chordal.cpython-311-darwin.so +0 -0
  121. sage/graphs/weakly_chordal.pyx +50 -8
  122. sage/groups/perm_gps/partn_ref/refinement_graphs.cpython-311-darwin.so +0 -0
  123. sage/knots/free_knotinfo_monoid.py +3 -3
  124. sage/knots/knotinfo.py +102 -82
  125. sage/knots/link.py +72 -39
  126. sage/topology/cubical_complex.py +4 -5
  127. sage/topology/delta_complex.py +4 -4
  128. sage/topology/simplicial_complex.py +0 -1
  129. sage/topology/simplicial_complex_catalog.py +6 -0
  130. sage/topology/simplicial_complex_examples.py +4 -16
  131. {passagemath_graphs-10.5.43.dist-info → passagemath_graphs-10.6.1rc2.dist-info}/WHEEL +0 -0
  132. {passagemath_graphs-10.5.43.dist-info → passagemath_graphs-10.6.1rc2.dist-info}/top_level.txt +0 -0
@@ -54,7 +54,6 @@ from sage.rings.rational import Rational
54
54
  from sage.arith.misc import binomial
55
55
  from sage.combinat.combination import Combinations
56
56
  from sage.combinat.designs.incidence_structures import IncidenceStructure
57
- from sage.cpython.string import bytes_to_str
58
57
 
59
58
 
60
59
  def schonheim(v, k, t):
@@ -522,11 +521,8 @@ def best_known_covering_design_www(v, k, t, verbose=False):
522
521
  if verbose:
523
522
  print("Looking up the bounds at %s" % url)
524
523
 
525
- f = urlopen(url, context=default_context())
526
- try:
527
- s = bytes_to_str(f.read())
528
- finally:
529
- f.close()
524
+ with urlopen(url, context=default_context()) as f:
525
+ s = f.read().decode()
530
526
 
531
527
  if 'covering not in database' in s: # not found
532
528
  str = "no (%d, %d, %d) covering design in database\n" % (v, k, t)
@@ -1111,7 +1111,8 @@ def OA_10_205():
1111
1111
 
1112
1112
  B = [0, 1, 22, 33, 83, 122, 135, 141, 145, 159, 175, 200, 226, 229, 231, 238, 246]
1113
1113
  pplane = [[(xx+i) % pplane_size for xx in B] for i in range(pplane_size)]
1114
- baer_subplane = set([i*pplane_size/baer_subplane_size for i in range(baer_subplane_size)])
1114
+ baer_subplane = {i * pplane_size / baer_subplane_size
1115
+ for i in range(baer_subplane_size)}
1115
1116
 
1116
1117
  p = list(baer_subplane)[0]
1117
1118
 
@@ -1530,8 +1531,8 @@ def OA_17_560():
1530
1531
  # We remove all elements except those from F_{p^alpha} in the last three
1531
1532
  # columns
1532
1533
 
1533
- elements_of_subgroup = set([x for x in G_set if x.polynomial().degree() < beta])
1534
- relabel = {G_to_int[v]:i for i,v in enumerate(elements_of_subgroup)}
1534
+ elements_of_subgroup = {x for x in G_set if x.polynomial().degree() < beta}
1535
+ relabel = {G_to_int[v]: i for i, v in enumerate(elements_of_subgroup)}
1535
1536
  for x in range(p**alpha):
1536
1537
  if x not in relabel:
1537
1538
  relabel[x] = None
@@ -2376,11 +2377,11 @@ def QDM_35_7_1_1_7():
2376
2377
  M = [
2377
2378
  [None,None,None,None,None,None,None],
2378
2379
  [ 0, 0, 0, 0, 0, 0, 0],
2379
- [ 18, -18, 11, -11, 5, -5, 4],
2380
+ [ 18, -18, 11, -11, 5, -5, 4],
2380
2381
  [ 26, -26, 10, -10, 30, -30, 23],
2381
- [ 20, -20, 3, -3, 33, -33, 23],
2382
- [ 5, -5, 25, -25, 24, -24, 4],
2383
- [ 17, -17, 4, -4, 22, -22, 0]
2382
+ [ 20, -20, 3, -3, 33, -33, 23],
2383
+ [ 5, -5, 25, -25, 24, -24, 4],
2384
+ [ 17, -17, 4, -4, 22, -22, 0]
2384
2385
  ]
2385
2386
 
2386
2387
  from sage.rings.finite_rings.integer_mod_ring import IntegerModRing as AdditiveCyclic
@@ -2417,10 +2418,10 @@ def QDM_45_7_1_1_9():
2417
2418
  M = [
2418
2419
  [None,None,None,None,None,None,None,None,None],
2419
2420
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0],
2420
- [ 1, 27, 16, 7, -1, -27, -16, -7, 3],
2421
- [ 24, 40, 1, 35, -24, -40, -1, -35, 7],
2421
+ [ 1, 27, 16, 7, -1, -27, -16, -7, 3],
2422
+ [ 24, 40, 1, 35, -24, -40, -1, -35, 7],
2422
2423
  [ 10, 30, 22, 44, -10, -30, -22, -44, 7],
2423
- [ 5, 18, 14, 33, -5, -18, -14, -33, 3],
2424
+ [ 5, 18, 14, 33, -5, -18, -14, -33, 3],
2424
2425
  [ 30, 16, 33, 27, -30, -16, -33, -27, 0],
2425
2426
  ]
2426
2427
 
@@ -949,12 +949,12 @@ cpdef _OA_cache_set(int k, int n, truth_value):
949
949
  _OA_cache_size = new_cache_size
950
950
 
951
951
  if truth_value is True:
952
- _OA_cache[n].max_true = k if k>_OA_cache[n].max_true else _OA_cache[n].max_true
952
+ _OA_cache[n].max_true = k if k>_OA_cache[n].max_true else _OA_cache[n].max_true
953
953
  elif truth_value is Unknown:
954
954
  _OA_cache[n].min_unknown = k if k<_OA_cache[n].min_unknown else _OA_cache[n].min_unknown
955
955
  _OA_cache[n].max_unknown = k if k>_OA_cache[n].max_unknown else _OA_cache[n].max_unknown
956
956
  else:
957
- _OA_cache[n].min_false = k if k<_OA_cache[n].min_false else _OA_cache[n].min_false
957
+ _OA_cache[n].min_false = k if k<_OA_cache[n].min_false else _OA_cache[n].min_false
958
958
 
959
959
  cpdef _OA_cache_get(int k, int n):
960
960
  r"""
@@ -534,7 +534,7 @@ cdef class EvenlyDistributedSetsBacktracker:
534
534
  x += 1
535
535
  else:
536
536
  kk += 1
537
- x += m - x%m
537
+ x += m - x % m
538
538
  else:
539
539
  x += 1
540
540
 
@@ -555,7 +555,7 @@ cdef class EvenlyDistributedSetsBacktracker:
555
555
  if self.check:
556
556
  self._check_cosets(kk)
557
557
  elif self.cosets[x / m]:
558
- x += m - x%m
558
+ x += m - x % m
559
559
  elif kk == 2:
560
560
  if self.min_orb[x] < x:
561
561
  x += 1
@@ -650,12 +650,12 @@ cdef class EvenlyDistributedSetsBacktracker:
650
650
  c = 0
651
651
  for i in range(self.e):
652
652
  c += self.cosets[i]
653
- if c != (kk * (kk-1)) / 2:
653
+ if 2 * c != (kk * (kk-1)):
654
654
  raise RuntimeError("the number of elements in cosets is wrong! Got {} instead of {}.".format(c, (kk*(kk-1))/2))
655
655
 
656
656
  for i in range(kk):
657
657
  for j in range(i):
658
658
  if self.cosets[ self.diff[self.B[i]][self.B[j]] / m ] != 1:
659
- raise RuntimeError("self.cosets misses the difference B[{}]-B[{}]".format(i,j))
659
+ raise RuntimeError("self.cosets misses the difference B[{}]-B[{}]".format(i, j))
660
660
 
661
661
  return 0
@@ -127,6 +127,8 @@ from itertools import repeat
127
127
  from sage.rings.integer import Integer
128
128
  from sage.categories.sets_cat import EmptySetError
129
129
  from sage.misc.unknown import Unknown
130
+ from sage.arith.misc import is_prime_power
131
+ from sage.rings.finite_rings.finite_field_constructor import GF
130
132
 
131
133
 
132
134
  def are_mutually_orthogonal_latin_squares(l, verbose=False):
@@ -240,22 +242,22 @@ def mutually_orthogonal_latin_squares(k, n, partitions=False, check=True):
240
242
 
241
243
  sage: designs.mutually_orthogonal_latin_squares(4,5) # needs sage.schemes
242
244
  [
243
- [0 2 4 1 3] [0 3 1 4 2] [0 4 3 2 1] [0 1 2 3 4]
244
- [4 1 3 0 2] [3 1 4 2 0] [2 1 0 4 3] [4 0 1 2 3]
245
- [3 0 2 4 1] [1 4 2 0 3] [4 3 2 1 0] [3 4 0 1 2]
246
- [2 4 1 3 0] [4 2 0 3 1] [1 0 4 3 2] [2 3 4 0 1]
247
- [1 3 0 2 4], [2 0 3 1 4], [3 2 1 0 4], [1 2 3 4 0]
245
+ [0 1 2 3 4] [0 1 2 3 4] [0 1 2 3 4] [0 1 2 3 4]
246
+ [1 2 3 4 0] [2 3 4 0 1] [3 4 0 1 2] [4 0 1 2 3]
247
+ [2 3 4 0 1] [4 0 1 2 3] [1 2 3 4 0] [3 4 0 1 2]
248
+ [3 4 0 1 2] [1 2 3 4 0] [4 0 1 2 3] [2 3 4 0 1]
249
+ [4 0 1 2 3], [3 4 0 1 2], [2 3 4 0 1], [1 2 3 4 0]
248
250
  ]
249
251
 
250
252
  sage: designs.mutually_orthogonal_latin_squares(3,7) # needs sage.schemes
251
253
  [
252
- [0 2 4 6 1 3 5] [0 3 6 2 5 1 4] [0 4 1 5 2 6 3]
253
- [6 1 3 5 0 2 4] [5 1 4 0 3 6 2] [4 1 5 2 6 3 0]
254
- [5 0 2 4 6 1 3] [3 6 2 5 1 4 0] [1 5 2 6 3 0 4]
255
- [4 6 1 3 5 0 2] [1 4 0 3 6 2 5] [5 2 6 3 0 4 1]
256
- [3 5 0 2 4 6 1] [6 2 5 1 4 0 3] [2 6 3 0 4 1 5]
257
- [2 4 6 1 3 5 0] [4 0 3 6 2 5 1] [6 3 0 4 1 5 2]
258
- [1 3 5 0 2 4 6], [2 5 1 4 0 3 6], [3 0 4 1 5 2 6]
254
+ [0 1 2 3 4 5 6] [0 1 2 3 4 5 6] [0 1 2 3 4 5 6]
255
+ [1 2 3 4 5 6 0] [2 3 4 5 6 0 1] [3 4 5 6 0 1 2]
256
+ [2 3 4 5 6 0 1] [4 5 6 0 1 2 3] [6 0 1 2 3 4 5]
257
+ [3 4 5 6 0 1 2] [6 0 1 2 3 4 5] [2 3 4 5 6 0 1]
258
+ [4 5 6 0 1 2 3] [1 2 3 4 5 6 0] [5 6 0 1 2 3 4]
259
+ [5 6 0 1 2 3 4] [3 4 5 6 0 1 2] [1 2 3 4 5 6 0]
260
+ [6 0 1 2 3 4 5], [5 6 0 1 2 3 4], [4 5 6 0 1 2 3]
259
261
  ]
260
262
 
261
263
  sage: designs.mutually_orthogonal_latin_squares(2,5,partitions=True) # needs sage.schemes
@@ -269,16 +271,16 @@ def mutually_orthogonal_latin_squares(k, n, partitions=False, check=True):
269
271
  [2, 7, 12, 17, 22],
270
272
  [3, 8, 13, 18, 23],
271
273
  [4, 9, 14, 19, 24]],
272
- [[0, 8, 11, 19, 22],
273
- [3, 6, 14, 17, 20],
274
- [1, 9, 12, 15, 23],
275
- [4, 7, 10, 18, 21],
276
- [2, 5, 13, 16, 24]],
277
274
  [[0, 9, 13, 17, 21],
278
- [2, 6, 10, 19, 23],
279
- [4, 8, 12, 16, 20],
280
275
  [1, 5, 14, 18, 22],
281
- [3, 7, 11, 15, 24]]]
276
+ [2, 6, 10, 19, 23],
277
+ [3, 7, 11, 15, 24],
278
+ [4, 8, 12, 16, 20]],
279
+ [[0, 8, 11, 19, 22],
280
+ [1, 9, 12, 15, 23],
281
+ [2, 5, 13, 16, 24],
282
+ [3, 6, 14, 17, 20],
283
+ [4, 7, 10, 18, 21]]]
282
284
 
283
285
  What is the maximum number of MOLS of size 8 that Sage knows how to build?::
284
286
 
@@ -342,6 +344,21 @@ def mutually_orthogonal_latin_squares(k, n, partitions=False, check=True):
342
344
  [3 4 5 6 7 1 2 0 8 9] [5 6 7 1 2 3 4 0 9 8]
343
345
  [4 5 6 7 1 2 3 9 0 8], [7 1 2 3 4 5 6 9 8 0]
344
346
  ]
347
+
348
+ Verify the construction from [KD2015]_::
349
+
350
+ sage: designs.mutually_orthogonal_latin_squares(2, 9)
351
+ [
352
+ [0 1 2 3 4 5 6 7 8] [0 1 2 3 4 5 6 7 8]
353
+ [2 3 6 4 1 8 0 5 7] [3 8 4 7 5 2 1 0 6]
354
+ [3 8 4 7 5 2 1 0 6] [4 7 1 5 8 6 3 2 0]
355
+ [4 7 1 5 8 6 3 2 0] [5 0 8 2 6 1 7 4 3]
356
+ [5 0 8 2 6 1 7 4 3] [6 4 0 1 3 7 2 8 5]
357
+ [6 4 0 1 3 7 2 8 5] [7 6 5 0 2 4 8 3 1]
358
+ [7 6 5 0 2 4 8 3 1] [8 2 7 6 0 3 5 1 4]
359
+ [8 2 7 6 0 3 5 1 4] [1 5 3 8 7 0 4 6 2]
360
+ [1 5 3 8 7 0 4 6 2], [2 3 6 4 1 8 0 5 7]
361
+ ]
345
362
  """
346
363
  from sage.combinat.designs.orthogonal_arrays import orthogonal_array
347
364
  from sage.matrix.constructor import Matrix
@@ -367,6 +384,22 @@ def mutually_orthogonal_latin_squares(k, n, partitions=False, check=True):
367
384
 
368
385
  matrices = construction()[:k]
369
386
 
387
+ # Implements the construction from Theorem 5.2.4 of [KD2015]_ for prime powers.
388
+ # This was implemented to fix :issue:`26107`, which pointed out that this
389
+ # function was unacceptably slow when n was a large prime power
390
+ elif is_prime_power(n):
391
+ F = list(GF(n))
392
+
393
+ # We need the first element of the list to be 0
394
+ assert F[0] == 0
395
+
396
+ # This dictionary is used to convert from field elements to integers
397
+ conv = {F[i] : i for i in range(n)}
398
+
399
+ # Make the matrices
400
+ matrices = [Matrix([[conv[F[i] + F[r]*F[j]] for i in range(n)]
401
+ for j in range(n)]) for r in range(1, k+1)]
402
+
370
403
  elif orthogonal_array(k + 2, n, existence=True) is not Unknown:
371
404
  # Forwarding non-existence results
372
405
  if orthogonal_array(k + 2, n, existence=True):
@@ -1724,7 +1724,8 @@ def OA_n_times_2_pow_c_from_matrix(k, c, G, A, Y, check=True):
1724
1724
  for i in range(len(B)):
1725
1725
  for j in range(i):
1726
1726
  g_to_col_indices = {g: [] for g in G}
1727
- Hij = set([(Y[i] - Y[j]) * v for v in H])
1727
+ YY = Y[i] - Y[j]
1728
+ Hij = {YY * v for v in H}
1728
1729
  for s in range(2 * G_card):
1729
1730
  g_to_col_indices[B[i][s] - B[j][s]].append(s)
1730
1731
  for s1, s2 in g_to_col_indices.values():
@@ -147,12 +147,13 @@ cpdef find_product_decomposition(int k, int n):
147
147
  """
148
148
  cdef int n1,n2
149
149
  for n1 in range(2, n):
150
- n2 = n/n1 # n2 is decreasing along the loop
150
+ if n % n1:
151
+ # we want to iterate only through divisors of n1... it seems
152
+ # faster to use that rather than calling the divisors function
153
+ continue
154
+ n2 = n // n1 # n2 is decreasing along the loop
151
155
  if n2 < n1:
152
156
  break
153
- if n%n1: # we want to iterate only through divisors of n1... it seems
154
- # faster to use that rather than calling the divisors function
155
- continue
156
157
  if is_available(k, n1) and is_available(k, n2):
157
158
  from sage.combinat.designs.orthogonal_arrays import wilson_construction
158
159
  return wilson_construction, (None,k,n1,n2,(),False)
@@ -188,11 +189,11 @@ cpdef find_wilson_decomposition_with_one_truncated_group(int k, int n):
188
189
  """
189
190
  cdef int r,u,m
190
191
  # If there exists a TD(k+1,t) then k+1 < t+2, i.e. k <= t
191
- for r in range(max(1,k),n-1):
192
- u = n%r
192
+ for r in range(max(1, k), n - 1):
193
+ u = n % r
193
194
  # We ensure that 1<=u, and that there can exists a TD(k,u), i.e k<u+2
194
195
  # (unless u == 1)
195
- if u == 0 or (u>1 and k >= u+2):
196
+ if u == 0 or (u > 1 and k >= u + 2):
196
197
  continue
197
198
 
198
199
  m = n // r
@@ -292,9 +293,9 @@ cpdef find_construction_3_3(int k, int n):
292
293
  (11, 11, 16, 1)
293
294
  sage: find_construction_3_3(12,11)
294
295
  """
295
- cdef int mm,nn,i
296
+ cdef int mm, nn, i
296
297
  for mm in range(k-1, n//2+1):
297
- if not(is_available(k, mm) and is_available(k, mm + 1)):
298
+ if not (is_available(k, mm) and is_available(k, mm + 1)):
298
299
  continue
299
300
 
300
301
  for nn in range(2, n//mm+1):
@@ -392,10 +393,10 @@ cpdef find_construction_3_5(int k, int n):
392
393
  for s in range(min(i+1,nn)):
393
394
  for r in range(max(0,i-nn-s), min(s+1,i-s+1,nn)):
394
395
  t = i - r - s
395
- if ((nn-r-1)*(nn-s) < t and
396
- (r==0 or is_available(k,r)) and
397
- (s==0 or is_available(k,s)) and
398
- (t==0 or is_available(k,t))):
396
+ if ((nn-r-1)*(nn-s) < t and
397
+ (r==0 or is_available(k, r)) and
398
+ (s==0 or is_available(k, s)) and
399
+ (t==0 or is_available(k, t))):
399
400
  from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_5
400
401
  return construction_3_5, (k,nn,mm,r,s,t)
401
402
 
@@ -482,15 +483,15 @@ cpdef find_q_x(int k, int n):
482
483
  x = (n-q**2+q-2)/(2-q)
483
484
  if (x < q and
484
485
  0 < x and
485
- n == (q-1)*(q-x)+x+2 and
486
- is_available(k+1,q-x-1) and
487
- is_available(k+1,q-x+1) and
486
+ n == (q-1)*(q-x)+x+2 and
487
+ is_available(k+1, q-x-1) and
488
+ is_available(k+1, q-x+1) and
488
489
  # The next is always True, because q is a prime power
489
490
  # is_available(k+1,q) and
490
- is_available(k, x+2 ) and
491
+ is_available(k, x+2 ) and
491
492
  smallInteger(q).is_prime_power()):
492
493
  from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_q_x
493
- return construction_q_x, (k,q,x)
494
+ return construction_q_x, (k, q, x)
494
495
  return False
495
496
 
496
497
  cpdef find_thwart_lemma_3_5(int k, int N):
@@ -866,11 +867,11 @@ def int_as_sum(int value, list S, int k_max):
866
867
  vv = v-i
867
868
  if vv == 0:
868
869
  return D[v] + (i,)
869
- if (vv > 0 and # The new integer i is too big
870
+ if (vv > 0 and # The new integer i is too big
870
871
  vv <= j*max_value and # The new integer i is too small
871
- vv not in D and # We had it in D already
872
+ vv not in D and # We had it in D already
872
873
  vv not in new_D): # We had it in new_D already
873
- new_D[vv] = D[v]+(i,)
874
+ new_D[vv] = D[v] + (i,)
874
875
  if not new_D:
875
876
  break
876
877
  D.update(new_D)