passagemath-graphs 10.5.10__cp39-cp39-macosx_14_0_arm64.whl → 10.5.43__cp39-cp39-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 (140) hide show
  1. {passagemath_graphs-10.5.10.dist-info → passagemath_graphs-10.5.43.dist-info}/METADATA +126 -30
  2. passagemath_graphs-10.5.43.dist-info/RECORD +256 -0
  3. {passagemath_graphs-10.5.10.dist-info → passagemath_graphs-10.5.43.dist-info}/WHEEL +2 -1
  4. passagemath_graphs.dylibs/libgmp.10.dylib +0 -0
  5. sage/all__sagemath_graphs.py +5 -0
  6. sage/combinat/abstract_tree.py +1 -1
  7. sage/combinat/binary_tree.py +1 -1
  8. sage/combinat/cluster_algebra_quiver/all.py +1 -1
  9. sage/combinat/cluster_algebra_quiver/cluster_seed.py +28 -24
  10. sage/combinat/cluster_algebra_quiver/interact.py +4 -0
  11. sage/combinat/designs/MOLS_handbook_data.py +5 -5
  12. sage/combinat/designs/bibd.py +10 -9
  13. sage/combinat/designs/covering_array.py +3 -3
  14. sage/combinat/designs/covering_design.py +2 -1
  15. sage/combinat/designs/database.py +11 -10
  16. sage/combinat/designs/designs_pyx.cpython-39-darwin.so +0 -0
  17. sage/combinat/designs/designs_pyx.pyx +13 -45
  18. sage/combinat/designs/difference_family.py +6 -6
  19. sage/combinat/designs/difference_matrices.py +1 -1
  20. sage/combinat/designs/evenly_distributed_sets.cpython-39-darwin.so +0 -0
  21. sage/combinat/designs/evenly_distributed_sets.pyx +15 -22
  22. sage/combinat/designs/ext_rep.py +9 -14
  23. sage/combinat/designs/gen_quadrangles_with_spread.cpython-39-darwin.so +0 -0
  24. sage/combinat/designs/gen_quadrangles_with_spread.pyx +1 -1
  25. sage/combinat/designs/group_divisible_designs.py +1 -1
  26. sage/combinat/designs/incidence_structures.py +8 -8
  27. sage/combinat/designs/latin_squares.py +1 -1
  28. sage/combinat/designs/orthogonal_arrays_build_recursive.py +8 -7
  29. sage/combinat/designs/orthogonal_arrays_find_recursive.cpython-39-darwin.so +0 -0
  30. sage/combinat/designs/resolvable_bibd.py +1 -1
  31. sage/combinat/designs/steiner_quadruple_systems.py +1 -1
  32. sage/combinat/designs/subhypergraph_search.cpython-39-darwin.so +0 -0
  33. sage/combinat/designs/subhypergraph_search.pyx +9 -9
  34. sage/combinat/finite_state_machine_generators.py +2 -2
  35. sage/combinat/graph_path.py +3 -3
  36. sage/combinat/interval_posets.py +10 -10
  37. sage/combinat/ordered_tree.py +1 -1
  38. sage/combinat/posets/cartesian_product.py +1 -1
  39. sage/combinat/posets/d_complete.py +1 -1
  40. sage/combinat/posets/forest.py +1 -1
  41. sage/combinat/posets/hasse_cython.cpython-39-darwin.so +0 -0
  42. sage/combinat/posets/hasse_diagram.py +8 -6
  43. sage/combinat/posets/incidence_algebras.py +8 -8
  44. sage/combinat/posets/lattices.py +28 -4
  45. sage/combinat/posets/linear_extension_iterator.cpython-39-darwin.so +0 -0
  46. sage/combinat/posets/linear_extension_iterator.pyx +2 -0
  47. sage/combinat/posets/linear_extensions.py +7 -16
  48. sage/combinat/posets/moebius_algebra.py +1 -1
  49. sage/combinat/posets/poset_examples.py +1 -1
  50. sage/combinat/posets/posets.py +54 -56
  51. sage/combinat/rooted_tree.py +3 -3
  52. sage/combinat/tamari_lattices.py +1 -1
  53. sage/ext_data/kenzo/CP2.txt +45 -0
  54. sage/ext_data/kenzo/CP3.txt +349 -0
  55. sage/ext_data/kenzo/CP4.txt +4774 -0
  56. sage/ext_data/kenzo/README.txt +49 -0
  57. sage/ext_data/kenzo/S4.txt +20 -0
  58. sage/graphs/asteroidal_triples.cpython-39-darwin.so +0 -0
  59. sage/graphs/base/boost_graph.cpython-39-darwin.so +0 -0
  60. sage/graphs/base/boost_graph.pxd +1 -1
  61. sage/graphs/base/boost_graph.pyx +1 -1
  62. sage/graphs/base/c_graph.cpython-39-darwin.so +0 -0
  63. sage/graphs/base/c_graph.pxd +4 -4
  64. sage/graphs/base/c_graph.pyx +270 -184
  65. sage/graphs/base/dense_graph.cpython-39-darwin.so +0 -0
  66. sage/graphs/base/graph_backends.cpython-39-darwin.so +0 -0
  67. sage/graphs/base/sparse_graph.cpython-39-darwin.so +0 -0
  68. sage/graphs/base/static_dense_graph.cpython-39-darwin.so +0 -0
  69. sage/graphs/base/static_sparse_backend.cpython-39-darwin.so +0 -0
  70. sage/graphs/base/static_sparse_backend.pyx +93 -6
  71. sage/graphs/base/static_sparse_graph.cpython-39-darwin.so +0 -0
  72. sage/graphs/base/static_sparse_graph.pyx +1 -1
  73. sage/graphs/bipartite_graph.py +0 -1
  74. sage/graphs/centrality.cpython-39-darwin.so +0 -0
  75. sage/graphs/centrality.pyx +0 -0
  76. sage/graphs/comparability.cpython-39-darwin.so +0 -0
  77. sage/graphs/comparability.pyx +172 -138
  78. sage/graphs/connectivity.cpython-39-darwin.so +0 -0
  79. sage/graphs/connectivity.pyx +194 -18
  80. sage/graphs/convexity_properties.cpython-39-darwin.so +0 -0
  81. sage/graphs/digraph_generators.py +118 -74
  82. sage/graphs/distances_all_pairs.cpython-39-darwin.so +0 -0
  83. sage/graphs/distances_all_pairs.pyx +145 -27
  84. sage/graphs/edge_connectivity.cpython-39-darwin.so +0 -0
  85. sage/graphs/generators/basic.py +471 -130
  86. sage/graphs/generators/distance_regular.cpython-39-darwin.so +0 -0
  87. sage/graphs/generators/distance_regular.pyx +12 -12
  88. sage/graphs/generators/families.py +2 -2
  89. sage/graphs/generators/random.py +8 -13
  90. sage/graphs/generators/smallgraphs.py +12 -11
  91. sage/graphs/generic_graph.py +687 -265
  92. sage/graphs/generic_graph_pyx.cpython-39-darwin.so +0 -0
  93. sage/graphs/genus.cpython-39-darwin.so +0 -0
  94. sage/graphs/graph.py +12 -46
  95. sage/graphs/graph_coloring.cpython-39-darwin.so +0 -0
  96. sage/graphs/graph_database.py +1 -1
  97. sage/graphs/graph_decompositions/bandwidth.cpython-39-darwin.so +0 -0
  98. sage/graphs/graph_decompositions/clique_separators.cpython-39-darwin.so +0 -0
  99. sage/graphs/graph_decompositions/cutwidth.cpython-39-darwin.so +0 -0
  100. sage/graphs/graph_decompositions/fast_digraph.cpython-39-darwin.so +0 -0
  101. sage/graphs/graph_decompositions/graph_products.cpython-39-darwin.so +0 -0
  102. sage/graphs/graph_decompositions/modular_decomposition.cpython-39-darwin.so +0 -0
  103. sage/graphs/graph_decompositions/slice_decomposition.cpython-39-darwin.so +0 -0
  104. sage/graphs/graph_decompositions/tree_decomposition.cpython-39-darwin.so +0 -0
  105. sage/graphs/graph_decompositions/vertex_separation.cpython-39-darwin.so +0 -0
  106. sage/graphs/graph_generators.py +110 -55
  107. sage/graphs/graph_generators_pyx.cpython-39-darwin.so +0 -0
  108. sage/graphs/graph_latex.py +1 -1
  109. sage/graphs/graph_list.py +2 -3
  110. sage/graphs/graph_plot.py +225 -30
  111. sage/graphs/hyperbolicity.cpython-39-darwin.so +0 -0
  112. sage/graphs/independent_sets.cpython-39-darwin.so +0 -0
  113. sage/graphs/isgci.py +3 -8
  114. sage/graphs/isoperimetric_inequalities.cpython-39-darwin.so +0 -0
  115. sage/graphs/line_graph.cpython-39-darwin.so +0 -0
  116. sage/graphs/matching.py +14 -25
  117. sage/graphs/matching_covered_graph.py +871 -60
  118. sage/graphs/orientations.py +190 -134
  119. sage/graphs/path_enumeration.cpython-39-darwin.so +0 -0
  120. sage/graphs/path_enumeration.pyx +25 -25
  121. sage/graphs/spanning_tree.cpython-39-darwin.so +0 -0
  122. sage/graphs/strongly_regular_db.cpython-39-darwin.so +0 -0
  123. sage/graphs/strongly_regular_db.pyx +54 -52
  124. sage/graphs/traversals.cpython-39-darwin.so +0 -0
  125. sage/graphs/traversals.pyx +114 -46
  126. sage/graphs/trees.cpython-39-darwin.so +0 -0
  127. sage/graphs/views.cpython-39-darwin.so +0 -0
  128. sage/graphs/weakly_chordal.cpython-39-darwin.so +0 -0
  129. sage/groups/perm_gps/partn_ref/refinement_graphs.cpython-39-darwin.so +0 -0
  130. sage/knots/free_knotinfo_monoid.py +2 -3
  131. sage/knots/knot.py +1 -1
  132. sage/knots/knotinfo.py +4 -4
  133. sage/knots/link.py +58 -57
  134. sage/sandpiles/sandpile.py +2 -3
  135. sage/topology/cell_complex.py +1 -1
  136. sage/topology/cubical_complex.py +7 -7
  137. sage/topology/delta_complex.py +4 -4
  138. sage/topology/simplicial_complex.py +7 -22
  139. passagemath_graphs-10.5.10.dist-info/RECORD +0 -251
  140. {passagemath_graphs-10.5.10.dist-info → passagemath_graphs-10.5.43.dist-info}/top_level.txt +0 -0
@@ -1,28 +1,34 @@
1
1
  # sage_setup: distribution = sagemath-graphs
2
- # sage.doctest: needs sage.graphs sage.modules
2
+ # sage.doctest: needs sage.graphs sage.modules sage.libs.singular
3
3
  r"""
4
- ClusterSeed
4
+ Cluster seeds
5
5
 
6
- A *cluster seed* is a pair `(B,\mathbf{x})` with `B` being a *skew-symmetrizable* `(n+m) \times n` *-matrix*
7
- and with `\mathbf{x}` being an `n`-tuple of *independent elements* in the field of rational functions in `n` variables.
6
+ A *cluster seed* is a pair `(B,\mathbf{x})` with `B` being a
7
+ *skew-symmetrizable* `(n+m) \times n` *-matrix* and with `\mathbf{x}` being an
8
+ `n`-tuple of *independent elements* in the field of rational functions in `n`
9
+ variables.
8
10
 
9
11
  For the compendium on the cluster algebra and quiver package see
10
12
  [MS2011]_.
11
13
 
12
- AUTHORS:
13
-
14
- - Gregg Musiker: Initial Version
15
- - Christian Stump: Initial Version
16
- - Aram Dermenjian (2015-07-01): Updating ability to not rely solely on clusters
17
- - Jesse Levitt (2015-07-01): Updating ability to not rely solely on clusters
18
-
19
14
  REFERENCES:
20
15
 
21
16
  - [FZ2007]_
22
-
23
17
  - [BDP2013]_
24
18
 
25
- .. SEEALSO:: For mutation types of cluster seeds, see :meth:`sage.combinat.cluster_algebra_quiver.quiver_mutation_type.QuiverMutationType`. Cluster seeds are closely related to :meth:`sage.combinat.cluster_algebra_quiver.quiver.ClusterQuiver`.
19
+ .. SEEALSO::
20
+
21
+ For mutation types of cluster seeds, see
22
+ :meth:`sage.combinat.cluster_algebra_quiver.quiver_mutation_type.QuiverMutationType`.
23
+ Cluster seeds are closely related to
24
+ :meth:`sage.combinat.cluster_algebra_quiver.quiver.ClusterQuiver`.
25
+
26
+ AUTHORS:
27
+
28
+ - Gregg Musiker: initial version
29
+ - Christian Stump: initial version
30
+ - Aram Dermenjian (2015-07-01): updating ability to not rely solely on clusters
31
+ - Jesse Levitt (2015-07-01): updating ability to not rely solely on clusters
26
32
  """
27
33
 
28
34
  # ****************************************************************************
@@ -333,7 +339,7 @@ class ClusterSeed(SageObject):
333
339
  else:
334
340
  labelset = set(user_labels)
335
341
  # Sanitizes our ``user_labels`` to use Integers instead of ints
336
- user_labels = [ZZ(x) if x in ZZ else x for x in user_labels]
342
+ user_labels = [Integer(x) if x in ZZ else x for x in user_labels]
337
343
  if labelset != set(self._nlist + self._mlist) and labelset != set(range(self._n + self._m)):
338
344
  raise ValueError('user_labels conflict with both the given'
339
345
  ' vertex labels and the default labels')
@@ -3594,7 +3600,7 @@ class ClusterSeed(SageObject):
3594
3600
  else:
3595
3601
  orbits = [index for index in range(n) if index > i or sd2._M[index, i] != 0]
3596
3602
 
3597
- clusters[cl2] = [sd2, orbits, clusters[key][2]+[i]]
3603
+ clusters[cl2] = [sd2, orbits, clusters[key][2] + [i]]
3598
3604
  if return_paths:
3599
3605
  yield (sd2, clusters[cl2][2])
3600
3606
  else:
@@ -3603,10 +3609,10 @@ class ClusterSeed(SageObject):
3603
3609
  if show_depth and gets_bigger:
3604
3610
  timer2 = time.time()
3605
3611
  dc = str(depth_counter)
3606
- dc += ' ' * (5-len(dc))
3612
+ dc += ' ' * (5 - len(dc))
3607
3613
  nr = str(len(clusters))
3608
- nr += ' ' * (10-len(nr))
3609
- print(f"Depth: {dc} found: {nr} Time: {timer2-timer:.2f} s")
3614
+ nr += ' ' * (10 - len(nr))
3615
+ print(f"Depth: {dc} found: {nr} Time: {timer2 - timer:.2f} s")
3610
3616
 
3611
3617
  def mutation_class(self, depth=infinity, show_depth=False, return_paths=False,
3612
3618
  up_to_equivalence=True, only_sink_source=False):
@@ -4719,7 +4725,7 @@ class ClusterSeed(SageObject):
4719
4725
  for l in range(num_cols):
4720
4726
  denominator = denominator * (R.gen(l))**vd[i][0][l]
4721
4727
  # Each copy of a vector in vd contributes a factor of the Laurent polynomial calculated from it.
4722
- final = (numerator/denominator)**vd[i][1]
4728
+ final = (numerator / denominator)**vd[i][1]
4723
4729
  finalP.append(final)
4724
4730
  laurentP = 1
4725
4731
  # The UCA element for the vector a is the product of the elements produced from the vectors in its decomposition.
@@ -4741,10 +4747,8 @@ def _bino(n, k):
4741
4747
  0
4742
4748
  """
4743
4749
  if n >= 0:
4744
- from sage.arith.misc import binomial
4745
- return binomial(n, k)
4746
- else:
4747
- return 0
4750
+ return Integer(n).binomial(k)
4751
+ return 0
4748
4752
 
4749
4753
 
4750
4754
  def coeff_recurs(p, q, a1, a2, b, c):
@@ -5193,7 +5197,7 @@ class ClusterVariable(FractionFieldElement):
5193
5197
  mt = self._mutation_type._repr_()
5194
5198
  # mt is a string of the shape "['A', 15]"
5195
5199
  # where A is a single letter and 15 is an integer
5196
- Phi = RootSystem([mt[2: 3], ZZ(mt[6: -1])])
5200
+ Phi = RootSystem([mt[2: 3], Integer(mt[6: -1])])
5197
5201
  Phiplus = Phi.root_lattice().simple_roots()
5198
5202
 
5199
5203
  if self.denominator() == 1:
@@ -1,4 +1,8 @@
1
1
  # sage_setup: distribution = sagemath-graphs
2
+ r"""
3
+ Interactive window for cluster seed mutations
4
+ """
5
+
2
6
  import ipywidgets as widgets
3
7
  from sage.misc.latex import latex
4
8
  from sage.repl.rich_output.pretty_print import pretty_print
@@ -1,11 +1,11 @@
1
1
  # sage_setup: distribution = sagemath-graphs
2
2
  r"""
3
- Known lower bounds on the number of Mutually Orthogonal Latin
4
- Squares (MOLS) of a given size.
3
+ Bounds on the number of mutually orthogonal Latin squares
5
4
 
6
- This module consists (almost) entirely of an internal, constant tuple
7
- of python integers corresponding to Table 3.87 in the Handbook of
8
- Combinatorial Designs, 2nd edition, by Colbourn and Dinitz. One public
5
+ This module contains known lower bounds on the number of mutually orthogonal
6
+ Latin squares (MOLS) of a given size, and consists (almost) entirely of an
7
+ internal, constant tuple of Python integers corresponding to Table 3.87 in the
8
+ Handbook of Combinatorial Designs, 2nd edition, by Colbourn and Dinitz. One public
9
9
  function, :func:`lower_bound`, is provided to access it.
10
10
 
11
11
  Make sure we have all of the entries::
@@ -1,6 +1,6 @@
1
1
  # sage_setup: distribution = sagemath-graphs
2
2
  r"""
3
- Balanced Incomplete Block Designs (BIBD)
3
+ Balanced incomplete block designs (BIBD)
4
4
 
5
5
  This module gathers everything related to Balanced Incomplete Block Designs. One can build a
6
6
  BIBD (or check that it can be built) with :func:`balanced_incomplete_block_design`::
@@ -614,7 +614,7 @@ def BIBD_from_TD(v, k, existence=False):
614
614
 
615
615
  BIBD = TDkv._blocks
616
616
  for i in range(k):
617
- BIBD.extend([[x+i*v for x in B] for B in BIBDvk])
617
+ BIBD.extend([x+i*v for x in B] for B in BIBDvk)
618
618
 
619
619
  # Second construction
620
620
  elif ((v-1) % k == 0 and
@@ -631,7 +631,7 @@ def BIBD_from_TD(v, k, existence=False):
631
631
  inf = v*k
632
632
  BIBD = TDkv
633
633
  for i in range(k):
634
- BIBD.extend([[inf if x == v else x+i*v for x in B] for B in BIBDv1k])
634
+ BIBD.extend([inf if x == v else x+i*v for x in B] for B in BIBDv1k)
635
635
 
636
636
  # Third construction
637
637
  elif ((v-k) % k == 0 and
@@ -651,7 +651,8 @@ def BIBD_from_TD(v, k, existence=False):
651
651
  BIBDvpkk = [B for B in BIBDvpkk if min(B) < v]
652
652
 
653
653
  for i in range(k):
654
- BIBD.extend([[(x-v)+inf if x >= v else x+i*v for x in B] for B in BIBDvpkk])
654
+ BIBD.extend([(x-v)+inf if x >= v else x+i*v for x in B]
655
+ for B in BIBDvpkk)
655
656
 
656
657
  BIBD.append(list(range(k * v, v * k + k)))
657
658
 
@@ -1278,14 +1279,14 @@ def BIBD_5q_5_for_q_prime_power(q):
1278
1279
 
1279
1280
  d = (q-1)//4
1280
1281
  B = []
1281
- F = FiniteField(q,'x')
1282
+ F = FiniteField(q, 'x')
1282
1283
  a = F.primitive_element()
1283
- L = {b:i for i,b in enumerate(F)}
1284
- for b in L:
1285
- B.append([i*q + L[b] for i in range(5)])
1284
+ L = {b: i for i, b in enumerate(F)}
1285
+ for b, Lb in L.items():
1286
+ B.append([i*q + Lb for i in range(5)])
1286
1287
  for i in range(5):
1287
1288
  for j in range(d):
1288
- B.append([ i*q + L[b ],
1289
+ B.append([ i*q + Lb,
1289
1290
  ((i+1) % 5)*q + L[ a**j+b ],
1290
1291
  ((i+1) % 5)*q + L[-a**j+b ],
1291
1292
  ((i+4) % 5)*q + L[ a**(j+d)+b],
@@ -1,13 +1,13 @@
1
1
  # sage_setup: distribution = sagemath-graphs
2
2
  r"""
3
- Covering Arrays (CA)
3
+ Covering arrays
4
4
 
5
- A Covering Array, denoted `CA(N;t,k,v)`, is an `N` by `k` array with
5
+ A covering array, denoted `CA(N;t,k,v)`, is an `N` by `k` array with
6
6
  entries from a set of `v` elements with the property that in every
7
7
  selection of `t` columns, every sequence of `t` elements appears in at
8
8
  least one row.
9
9
 
10
- An Orthogonal Array, denoted `OA(N;t,k,v)` is a covering array with the
10
+ An orthogonal array, denoted `OA(N;t,k,v)` is a covering array with the
11
11
  property that every sequence of `t`-elements appears in exactly one row.
12
12
  (See :mod:`sage.combinat.designs.orthogonal_arrays`).
13
13
 
@@ -49,7 +49,6 @@ Classes and methods
49
49
  from urllib.request import urlopen
50
50
  from ssl import create_default_context as default_context
51
51
 
52
- from sage.misc.sage_eval import sage_eval
53
52
  from sage.structure.sage_object import SageObject
54
53
  from sage.rings.rational import Rational
55
54
  from sage.arith.misc import binomial
@@ -513,6 +512,8 @@ def best_known_covering_design_www(v, k, t, verbose=False):
513
512
  A :exc:`ValueError` is raised if the ``(v, k, t)`` parameters are not
514
513
  found in the database.
515
514
  """
515
+ from sage.misc.sage_eval import sage_eval
516
+
516
517
  v = int(v)
517
518
  k = int(k)
518
519
  t = int(t)
@@ -1059,8 +1059,8 @@ def OA_11_185():
1059
1059
  assert all(len(B) in (11,13) or set(B) == set(special_set) for B in PBD)
1060
1060
 
1061
1061
  OA = OA_from_PBD(11,185,[B for B in PBD if len(B) < 17],check=False)[:-185]
1062
- OA.extend([[i]*11 for i in range(185) if i not in special_set])
1063
- OA.extend([[special_set[x] for x in B] for B in orthogonal_array(11,17)])
1062
+ OA.extend([i]*11 for i in range(185) if i not in special_set)
1063
+ OA.extend([special_set[x] for x in B] for B in orthogonal_array(11,17))
1064
1064
  return OA
1065
1065
 
1066
1066
 
@@ -1127,7 +1127,7 @@ def OA_10_205():
1127
1127
  GDD = [[relabel[xx] for xx in B if xx in relabel] for B in pplane if p not in B]
1128
1128
 
1129
1129
  # We turn the GDD into a PBD by extending the groups with a new point 204.
1130
- GDD.extend([[relabel[xx] for xx in G]+[204] for G in groups])
1130
+ GDD.extend([relabel[xx] for xx in G]+[204] for G in groups)
1131
1131
 
1132
1132
  # We build the OA, knowing that the blocks of size 9 are disjoint
1133
1133
  blocks_of_size_9 = [B for B in GDD if len(B) == 9]
@@ -1135,13 +1135,13 @@ def OA_10_205():
1135
1135
 
1136
1136
  OA = OA_from_PBD(10,205,[B for B in GDD if len(B) != 9],check=False)[:-205]
1137
1137
 
1138
- OA.extend([[B[xx] for xx in R]
1139
- for R in orthogonal_array(10,9)
1140
- for B in blocks_of_size_9])
1138
+ OA.extend([B[xx] for xx in R]
1139
+ for R in orthogonal_array(10,9)
1140
+ for B in blocks_of_size_9)
1141
1141
 
1142
1142
  # The missing [i,i,...] blocks
1143
- OA.extend([[i]*10
1144
- for i in set(range(205)).difference(blocks_of_size_9_union)])
1143
+ OA.extend([i]*10
1144
+ for i in set(range(205)).difference(blocks_of_size_9_union))
1145
1145
 
1146
1146
  return OA
1147
1147
 
@@ -1628,7 +1628,8 @@ def OA_10_796():
1628
1628
  OA = OA_relabel(OA,17,47,blocks=[OA[0]]) # making sure [46]*17 is a block
1629
1629
  PBD = [[i*47+x for i,x in enumerate(B) if (x < 46 or i < 13)] for B in OA]
1630
1630
  extra_point = 10000
1631
- PBD.extend([list(range(i*47,(i+1)*47-int(i >= 13)))+[extra_point] for i in range(17)]) # Adding the columns
1631
+ PBD.extend(list(range(i*47,(i+1)*47-int(i >= 13)))+[extra_point]
1632
+ for i in range(17)) # Adding the columns
1632
1633
 
1633
1634
  rel = {v:i for i,v in enumerate(set(range(17*47)).difference([(i+1)*47-1 for i in range(13,17)]))}
1634
1635
  rel[extra_point] = len(rel)
@@ -1646,7 +1647,7 @@ def OA_10_796():
1646
1647
  for B in PBD:
1647
1648
  if len(B) >= 47:
1648
1649
  B.sort(key=lambda x:int(x == extra_point))
1649
- OA.extend([[B[i] for i in BB] for BB in iOA[len(B)]])
1650
+ OA.extend([B[i] for i in BB] for BB in iOA[len(B)])
1650
1651
  span.update(B[:-1])
1651
1652
  else:
1652
1653
  others.append(B)
@@ -12,7 +12,8 @@ from sage.data_structures.bitset_base cimport *
12
12
 
13
13
  from libc.string cimport memset
14
14
 
15
- from cysignals.memory cimport sig_malloc, sig_calloc, sig_realloc, sig_free
15
+ from cysignals.memory cimport sig_malloc, sig_realloc, sig_free
16
+ from memory_allocator cimport MemoryAllocator
16
17
 
17
18
  from sage.misc.unknown import Unknown
18
19
 
@@ -306,7 +307,8 @@ def is_orthogonal_array(OA, int k, int n, int t=2, verbose=False, terminology='O
306
307
  cdef int i,j,l
307
308
 
308
309
  # A copy of OA
309
- cdef unsigned short * OAc = <unsigned short *> sig_malloc(k*n2*sizeof(unsigned short))
310
+ cdef MemoryAllocator mem = MemoryAllocator()
311
+ cdef unsigned short * OAc = <unsigned short *> mem.malloc(k*n2*sizeof(unsigned short))
310
312
 
311
313
  cdef unsigned short * C1
312
314
  cdef unsigned short * C2
@@ -322,7 +324,6 @@ def is_orthogonal_array(OA, int k, int n, int t=2, verbose=False, terminology='O
322
324
  if verbose:
323
325
  print({"OA": "{} is not in the interval [0..{}]".format(x,n-1),
324
326
  "MOLS": "Entry {} was expected to be in the interval [0..{}]".format(x,n-1)}[terminology])
325
- sig_free(OAc)
326
327
  return False
327
328
  OAc[j*n2+i] = x
328
329
 
@@ -339,14 +340,12 @@ def is_orthogonal_array(OA, int k, int n, int t=2, verbose=False, terminology='O
339
340
  bitset_add(seen,n*C1[l]+C2[l])
340
341
 
341
342
  if bitset_len(seen) != n2: # Have we seen all pairs ?
342
- sig_free(OAc)
343
343
  bitset_free(seen)
344
344
  if verbose:
345
345
  print({"OA": "Columns {} and {} are not orthogonal".format(i,j),
346
346
  "MOLS": "Squares {} and {} are not orthogonal".format(i,j)}[terminology])
347
347
  return False
348
348
 
349
- sig_free(OAc)
350
349
  bitset_free(seen)
351
350
  return True
352
351
 
@@ -470,9 +469,8 @@ def is_group_divisible_design(groups, blocks, v, G=None, K=None, lambd=1, verbos
470
469
  print("{} does not belong to [0,...,{}]".format(x, n-1))
471
470
  return False
472
471
 
473
- cdef unsigned short * matrix = <unsigned short *> sig_calloc(n*n, sizeof(unsigned short))
474
- if matrix is NULL:
475
- raise MemoryError
472
+ cdef MemoryAllocator mem = MemoryAllocator()
473
+ cdef unsigned short * matrix = <unsigned short *> mem.calloc(n*n, sizeof(unsigned short))
476
474
 
477
475
  # Counts the number of occurrences of each pair of points
478
476
  for b in blocks:
@@ -501,7 +499,6 @@ def is_group_divisible_design(groups, blocks, v, G=None, K=None, lambd=1, verbos
501
499
  if not len(g) in G:
502
500
  if verbose:
503
501
  print("a group has size {} while G={}".format(len(g),list(G)))
504
- sig_free(matrix)
505
502
  return False
506
503
 
507
504
  # Checks that two points of the same group were never covered
@@ -514,7 +511,6 @@ def is_group_divisible_design(groups, blocks, v, G=None, K=None, lambd=1, verbos
514
511
  if matrix[ii*n+jj] != 0:
515
512
  if verbose:
516
513
  print("the pair ({},{}) belongs to a group but appears in some block".format(ii, jj))
517
- sig_free(matrix)
518
514
  return False
519
515
 
520
516
  # We fill the entries with what is expected by the next loop
@@ -527,11 +523,8 @@ def is_group_divisible_design(groups, blocks, v, G=None, K=None, lambd=1, verbos
527
523
  if matrix[i*n+j] != l:
528
524
  if verbose:
529
525
  print("the pair ({},{}) has been seen {} times but lambda={}".format(i,j,matrix[i*n+j],l))
530
- sig_free(matrix)
531
526
  return False
532
527
 
533
- sig_free(matrix)
534
-
535
528
  return True if not guess_groups else (True, groups)
536
529
 
537
530
 
@@ -823,9 +816,9 @@ def is_quasi_difference_matrix(M, G, int k, int lmbda, int mu, int u, verbose=Fa
823
816
 
824
817
  # Width of the matrix
825
818
  for R in M:
826
- if len(R)!=k:
819
+ if len(R) != k:
827
820
  if verbose:
828
- print("The matrix has {} columns but k={}".format(len(R),k))
821
+ print("The matrix has {} columns but k={}".format(len(R), k))
829
822
  return False
830
823
 
831
824
  # When |G|=0
@@ -837,16 +830,11 @@ def is_quasi_difference_matrix(M, G, int k, int lmbda, int mu, int u, verbose=Fa
837
830
  cdef dict group_to_int = {v:i for i,v in enumerate(int_to_group)}
838
831
 
839
832
  # Allocations
840
- cdef int ** x_minus_y = <int **> sig_malloc((n+1)*sizeof(int *))
841
- cdef int * x_minus_y_data = <int *> sig_malloc((n+1)*(n+1)*sizeof(int))
842
- cdef int * M_c = <int *> sig_malloc(k*M_nrows*sizeof(int))
843
- cdef int * G_seen = <int *> sig_malloc((n+1)*sizeof(int))
844
- if (x_minus_y == NULL or x_minus_y_data == NULL or M_c == NULL or G_seen == NULL):
845
- sig_free(x_minus_y)
846
- sig_free(x_minus_y_data)
847
- sig_free(G_seen)
848
- sig_free(M_c)
849
- raise MemoryError
833
+ cdef MemoryAllocator mem = MemoryAllocator()
834
+ cdef int ** x_minus_y = <int **> mem.malloc((n+1)*sizeof(int *))
835
+ cdef int * x_minus_y_data = <int *> mem.malloc((n+1)*(n+1)*sizeof(int))
836
+ cdef int * M_c = <int *> mem.malloc(k*M_nrows*sizeof(int))
837
+ cdef int * G_seen = <int *> mem.malloc((n+1)*sizeof(int))
850
838
 
851
839
  # The "x-y" table. If g_i, g_j \in G, then x_minus_y[i][j] is equal to
852
840
  # group_to_int[g_i-g_j].
@@ -884,10 +872,6 @@ def is_quasi_difference_matrix(M, G, int k, int lmbda, int mu, int u, verbose=Fa
884
872
  if bit:
885
873
  if verbose:
886
874
  print("Row {} contains more than one empty entry".format(i))
887
- sig_free(x_minus_y_data)
888
- sig_free(x_minus_y)
889
- sig_free(G_seen)
890
- sig_free(M_c)
891
875
  return False
892
876
  bit = True
893
877
 
@@ -901,10 +885,6 @@ def is_quasi_difference_matrix(M, G, int k, int lmbda, int mu, int u, verbose=Fa
901
885
  if verbose:
902
886
  print("Column {} contains {} empty entries instead of the expected "
903
887
  "lambda.u={}.{}={}".format(j, ii, lmbda, u, lmbda*u))
904
- sig_free(x_minus_y_data)
905
- sig_free(x_minus_y)
906
- sig_free(G_seen)
907
- sig_free(M_c)
908
888
  return False
909
889
 
910
890
  # We are now ready to test every pair of columns
@@ -918,10 +898,6 @@ def is_quasi_difference_matrix(M, G, int k, int lmbda, int mu, int u, verbose=Fa
918
898
  if verbose:
919
899
  print("Columns {} and {} generate 0 exactly {} times "
920
900
  "instead of the expected mu(={})".format(i,j,G_seen[0],mu))
921
- sig_free(x_minus_y_data)
922
- sig_free(x_minus_y)
923
- sig_free(G_seen)
924
- sig_free(M_c)
925
901
  return False
926
902
 
927
903
  for ii in range(1,n): # bad number of g_ii\in G
@@ -930,16 +906,8 @@ def is_quasi_difference_matrix(M, G, int k, int lmbda, int mu, int u, verbose=Fa
930
906
  print("Columns {} and {} do not generate all elements of G "
931
907
  "exactly lambda(={}) times. The element {} appeared {} "
932
908
  "times as a difference.".format(i,j,lmbda,int_to_group[ii],G_seen[ii]))
933
- sig_free(x_minus_y_data)
934
- sig_free(x_minus_y)
935
- sig_free(G_seen)
936
- sig_free(M_c)
937
909
  return False
938
910
 
939
- sig_free(x_minus_y_data)
940
- sig_free(x_minus_y)
941
- sig_free(G_seen)
942
- sig_free(M_c)
943
911
  return True
944
912
 
945
913
 
@@ -293,8 +293,8 @@ def is_difference_family(G, D, v=None, k=None, l=None, verbose=False):
293
293
 
294
294
  # Normalized number of occurrences added to counter
295
295
  stabi = len(stab[i])
296
- for gg in tmp_counter:
297
- counter[gg] += tmp_counter[gg]//stabi
296
+ for gg, tmp_gg in tmp_counter.items():
297
+ counter[gg] += tmp_gg // stabi
298
298
 
299
299
  # Check the counter and report any error
300
300
  too_few = []
@@ -1580,7 +1580,7 @@ def is_relative_difference_set(R, G, H, params, verbose=False):
1580
1580
  - ``H`` -- list; a submodule of ``G`` of order `n`
1581
1581
  - ``params`` -- tuple in the form `(m, n, k, d)`
1582
1582
  - ``verbose`` -- boolean (default: ``False``); if ``True``, the function
1583
- will be verbose when the sequences do not satisfy the contraints
1583
+ will be verbose when the sequences do not satisfy the constraints
1584
1584
 
1585
1585
  EXAMPLES::
1586
1586
 
@@ -1660,7 +1660,7 @@ def is_supplementary_difference_set(Ks, v=None, lmbda=None, G=None, verbose=Fals
1660
1660
  - ``lmbda`` -- integer; the parameter `\lambda` of the supplementary difference sets
1661
1661
  - ``G`` -- a group of order `v`
1662
1662
  - ``verbose`` -- boolean (default: ``False``); if ``True``, the function will
1663
- be verbose when the sets do not satisfy the contraints
1663
+ be verbose when the sets do not satisfy the constraints
1664
1664
 
1665
1665
  EXAMPLES::
1666
1666
 
@@ -1758,7 +1758,7 @@ def supplementary_difference_set_from_rel_diff_set(q, existence=False, check=Tru
1758
1758
  OUTPUT:
1759
1759
 
1760
1760
  If ``existence=False``, the function returns the 4 sets (containing integers),
1761
- or raises an error if ``q`` does not satify the constraints.
1761
+ or raises an error if ``q`` does not satisfy the constraints.
1762
1762
  If ``existence=True``, the function returns a boolean representing whether
1763
1763
  supplementary difference sets can be constructed.
1764
1764
 
@@ -3085,7 +3085,7 @@ def are_complementary_difference_sets(G, A, B, verbose=False):
3085
3085
  - ``A`` -- set of elements of ``G``
3086
3086
  - ``B`` -- set of elements of ``G``
3087
3087
  - ``verbose`` -- boolean (default: ``False``); if ``True`` the function will
3088
- be verbose when the sets do not satisfy the contraints
3088
+ be verbose when the sets do not satisfy the constraints
3089
3089
 
3090
3090
  EXAMPLES::
3091
3091
 
@@ -1,7 +1,7 @@
1
1
  # sage_setup: distribution = sagemath-graphs
2
2
  # sage.doctest: needs sage.rings.finite_rings
3
3
  r"""
4
- Difference Matrices
4
+ Difference matrices
5
5
 
6
6
  This module gathers code related to difference matrices. One can build those
7
7
  objects (or know if they can be built) with :func:`difference_matrix`::
@@ -19,14 +19,15 @@ Classes and methods
19
19
 
20
20
  cimport cython
21
21
 
22
- from sage.categories.fields import Fields
23
22
  from libc.limits cimport UINT_MAX
24
23
  from libc.string cimport memset, memcpy
25
-
26
- from cysignals.memory cimport check_malloc, check_calloc, sig_free
24
+ from memory_allocator cimport MemoryAllocator
27
25
 
28
26
  from sage.rings.integer cimport smallInteger
29
27
 
28
+ from sage.categories.fields import Fields
29
+
30
+
30
31
  cdef class EvenlyDistributedSetsBacktracker:
31
32
  r"""
32
33
  Set of evenly distributed subsets in finite fields.
@@ -169,17 +170,8 @@ cdef class EvenlyDistributedSetsBacktracker:
169
170
  cdef unsigned int * cosets # e array: cosets of differences of elts in B
170
171
  cdef unsigned int * t # e array: temporary variable for updates
171
172
 
172
- def __dealloc__(self):
173
- if self.diff != NULL:
174
- sig_free(self.diff[0])
175
- sig_free(self.diff)
176
- if self.ratio != NULL:
177
- sig_free(self.ratio[0])
178
- sig_free(self.ratio)
179
- sig_free(self.min_orb)
180
- sig_free(self.B)
181
- sig_free(self.cosets)
182
- sig_free(self.t)
173
+ # MANAGEMENT OF MEMORY
174
+ cdef MemoryAllocator mem
183
175
 
184
176
  def __init__(self, K, k, up_to_isomorphism=True, check=False):
185
177
  r"""
@@ -229,20 +221,21 @@ cdef class EvenlyDistributedSetsBacktracker:
229
221
  self.m = (q - 1) // e
230
222
  self.K = K
231
223
 
232
- self.diff = <unsigned int **> check_calloc(q, sizeof(unsigned int *))
233
- self.diff[0] = <unsigned int *> check_malloc(q*q*sizeof(unsigned int))
224
+ self.mem = MemoryAllocator()
225
+ self.diff = <unsigned int **> self.mem.calloc(q, sizeof(unsigned int *))
226
+ self.diff[0] = <unsigned int *> self.mem.malloc(q*q*sizeof(unsigned int))
234
227
  for i in range(1, self.q):
235
228
  self.diff[i] = self.diff[i-1] + q
236
229
 
237
- self.ratio = <unsigned int **> check_calloc(q, sizeof(unsigned int *))
238
- self.ratio[0] = <unsigned int *> check_malloc(q*q*sizeof(unsigned int))
230
+ self.ratio = <unsigned int **> self.mem.calloc(q, sizeof(unsigned int *))
231
+ self.ratio[0] = <unsigned int *> self.mem.malloc(q*q*sizeof(unsigned int))
239
232
  for i in range(1, self.q):
240
233
  self.ratio[i] = self.ratio[i-1] + q
241
234
 
242
- self.B = <unsigned int *> check_malloc(k*sizeof(unsigned int))
243
- self.min_orb = <unsigned int *> check_malloc(q*sizeof(unsigned int))
244
- self.cosets = <unsigned int *> check_malloc(e*sizeof(unsigned int))
245
- self.t = <unsigned int *> check_malloc(e*sizeof(unsigned int))
235
+ self.B = <unsigned int *> self.mem.malloc(k*sizeof(unsigned int))
236
+ self.min_orb = <unsigned int *> self.mem.malloc(q*sizeof(unsigned int))
237
+ self.cosets = <unsigned int *> self.mem.malloc(e*sizeof(unsigned int))
238
+ self.t = <unsigned int *> self.mem.malloc(e*sizeof(unsigned int))
246
239
 
247
240
  x = K.multiplicative_generator()
248
241
  list_K = []
@@ -1,13 +1,13 @@
1
1
  # sage_setup: distribution = sagemath-graphs
2
2
  r"""
3
- External Representations of Block Designs
3
+ External representations of block designs
4
4
 
5
- The "ext_rep" module is an API to the abstract tree represented by
5
+ This module is an API to the abstract tree represented by
6
6
  an XML document containing the External Representation of a list of
7
7
  block designs. The module also provides the related I/O operations for
8
- reading/writing ext-rep files or data. The parsing is based on expat.
8
+ reading/writing ``ext-rep`` files or data. The parsing is based on expat.
9
9
 
10
- This is a modified form of the module ext_rep.py (version 0.8)
10
+ This is a modified form of the module ``ext_rep.py`` (version 0.8)
11
11
  written by Peter Dobcsanyi [Do2009]_ peter@designtheory.org.
12
12
 
13
13
  .. TODO::
@@ -16,12 +16,9 @@ written by Peter Dobcsanyi [Do2009]_ peter@designtheory.org.
16
16
  information about things like automorphism groups, transitivity, cycle type
17
17
  representatives, etc, but none of this data is made available through the
18
18
  current implementation.
19
-
20
- Functions
21
- ---------
22
19
  """
23
20
 
24
- ###########################################################################
21
+ # ***********************************************************************
25
22
  # This software is released under the terms of the GNU General Public
26
23
  # License, version 2 or above (your choice). For details on licensing,
27
24
  # see the accompanying documentation.
@@ -29,9 +26,9 @@ Functions
29
26
  # This is a modified form of the module ext_rep.py (version 0.8)
30
27
  # written by Peter Dobcsanyi peter@designtheory.org.
31
28
  #
32
- # Copyright 2004 by Peter Dobcsanyi peter@designtheory.org, and copyright
33
- # 2009 Carlo Hamalainen carlo.hamalainen@gmail.com
34
- ###########################################################################
29
+ # Copyright 2004 Peter Dobcsanyi peter@designtheory.org
30
+ # 2009 Carlo Hamalainen carlo.hamalainen@gmail.com
31
+ # ***********************************************************************
35
32
 
36
33
  import sys
37
34
  import xml.parsers.expat
@@ -598,7 +595,6 @@ def _encode_attribute(string):
598
595
  sage: _encode_attribute('E')
599
596
  'E'
600
597
  """
601
-
602
598
  if pattern_integer.match(string):
603
599
  return int(string)
604
600
  elif pattern_decimal.match(string):
@@ -611,8 +607,7 @@ class XTree:
611
607
  '''
612
608
  A lazy class to wrap a rooted tree representing an XML document.
613
609
  The tree's nodes are tuples of the structure:
614
-
615
- (name, {dictionary of attributes}, [list of children])
610
+ (name, {dictionary of attributes}, [list of children])
616
611
 
617
612
  Methods and services of an XTree object ``t``:
618
613
 
@@ -268,7 +268,7 @@ def generalised_quadrangle_hermitian_with_ovoid(const int q):
268
268
  TESTS::
269
269
 
270
270
  sage: from sage.combinat.designs.gen_quadrangles_with_spread import \
271
- is_GQ_with_spread, dual_GQ_ovoid
271
+ ....: is_GQ_with_spread, dual_GQ_ovoid
272
272
  sage: t = designs.generalised_quadrangle_hermitian_with_ovoid(3)
273
273
  sage: t = dual_GQ_ovoid(*t)
274
274
  sage: is_GQ_with_spread(*t, s=3, t=9)