passagemath-modules 10.5.32__cp310-cp310-macosx_14_0_arm64.whl → 10.6.20__cp310-cp310-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.

Potentially problematic release.


This version of passagemath-modules might be problematic. Click here for more details.

Files changed (334) hide show
  1. {passagemath_modules-10.5.32.dist-info → passagemath_modules-10.6.20.dist-info}/METADATA +51 -46
  2. {passagemath_modules-10.5.32.dist-info → passagemath_modules-10.6.20.dist-info}/RECORD +333 -323
  3. {passagemath_modules-10.5.32.dist-info → passagemath_modules-10.6.20.dist-info}/WHEEL +1 -1
  4. passagemath_modules.dylibs/libgcc_s.1.1.dylib +0 -0
  5. passagemath_modules.dylibs/libgfortran.5.dylib +0 -0
  6. passagemath_modules.dylibs/libgsl.28.dylib +0 -0
  7. passagemath_modules.dylibs/libmpc.3.dylib +0 -0
  8. passagemath_modules.dylibs/libopenblasp-r0.3.29.dylib +0 -0
  9. passagemath_modules.dylibs/libquadmath.0.dylib +0 -0
  10. sage/algebras/clifford_algebra.py +2 -2
  11. sage/algebras/clifford_algebra_element.cpython-310-darwin.so +0 -0
  12. sage/algebras/clifford_algebra_element.pyx +4 -2
  13. sage/algebras/exterior_algebra_groebner.cpython-310-darwin.so +0 -0
  14. sage/algebras/exterior_algebra_groebner.pyx +2 -0
  15. sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py +83 -5
  16. sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.cpython-310-darwin.so +0 -0
  17. sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pxd +2 -0
  18. sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx +28 -3
  19. sage/algebras/finite_gca.py +1 -1
  20. sage/algebras/lie_algebras/bgg_dual_module.py +18 -11
  21. sage/algebras/lie_algebras/classical_lie_algebra.py +3 -3
  22. sage/algebras/lie_algebras/examples.py +2 -2
  23. sage/algebras/lie_algebras/free_lie_algebra.py +1 -1
  24. sage/algebras/lie_algebras/heisenberg.py +4 -4
  25. sage/algebras/lie_algebras/lie_algebra.py +1 -1
  26. sage/algebras/lie_algebras/lie_algebra_element.cpython-310-darwin.so +0 -0
  27. sage/algebras/lie_algebras/lie_algebra_element.pyx +65 -28
  28. sage/algebras/lie_algebras/quotient.py +40 -29
  29. sage/algebras/lie_algebras/subalgebra.py +76 -53
  30. sage/algebras/lie_algebras/verma_module.py +1 -3
  31. sage/algebras/octonion_algebra.cpython-310-darwin.so +0 -0
  32. sage/algebras/octonion_algebra.pyx +1 -1
  33. sage/algebras/orlik_solomon.py +4 -4
  34. sage/algebras/orlik_terao.py +4 -4
  35. sage/algebras/steenrod/steenrod_algebra.py +37 -30
  36. sage/algebras/steenrod/steenrod_algebra_bases.py +2 -2
  37. sage/algebras/steenrod/steenrod_algebra_misc.py +4 -4
  38. sage/algebras/steenrod/steenrod_algebra_mult.py +2 -2
  39. sage/all__sagemath_modules.py +1 -0
  40. sage/calculus/integration.cpython-310-darwin.so +0 -0
  41. sage/calculus/integration.pyx +6 -5
  42. sage/calculus/interpolation.cpython-310-darwin.so +0 -0
  43. sage/calculus/interpolators.cpython-310-darwin.so +0 -0
  44. sage/calculus/ode.cpython-310-darwin.so +0 -0
  45. sage/calculus/ode.pxd +2 -2
  46. sage/calculus/ode.pyx +6 -4
  47. sage/calculus/riemann.cpython-310-darwin.so +0 -0
  48. sage/calculus/riemann.pyx +68 -48
  49. sage/calculus/transforms/dwt.cpython-310-darwin.so +0 -0
  50. sage/calculus/transforms/fft.cpython-310-darwin.so +0 -0
  51. sage/coding/ag_code_decoders.cpython-310-darwin.so +0 -0
  52. sage/coding/ag_code_decoders.pyx +31 -31
  53. sage/coding/binary_code.cpython-310-darwin.so +0 -0
  54. sage/coding/binary_code.pxd +6 -6
  55. sage/coding/binary_code.pyx +212 -173
  56. sage/coding/guruswami_sudan/utils.py +3 -5
  57. sage/coding/kasami_codes.cpython-310-darwin.so +0 -0
  58. sage/coding/kasami_codes.pyx +20 -24
  59. sage/coding/linear_code.py +2 -2
  60. sage/coding/linear_code_no_metric.py +5 -5
  61. sage/coding/linear_rank_metric.py +81 -19
  62. sage/combinat/cartesian_product.py +1 -1
  63. sage/combinat/free_module.py +22 -2
  64. sage/combinat/root_system/all.py +1 -1
  65. sage/combinat/root_system/ambient_space.py +1 -1
  66. sage/combinat/root_system/associahedron.py +4 -4
  67. sage/combinat/root_system/braid_move_calculator.py +2 -2
  68. sage/combinat/root_system/braid_orbit.cpython-310-darwin.so +0 -0
  69. sage/combinat/root_system/braid_orbit.pyx +1 -1
  70. sage/combinat/root_system/branching_rules.py +3 -3
  71. sage/combinat/root_system/cartan_type.py +14 -14
  72. sage/combinat/root_system/coxeter_group.py +3 -3
  73. sage/combinat/root_system/coxeter_matrix.py +1 -1
  74. sage/combinat/root_system/coxeter_type.py +12 -1
  75. sage/combinat/root_system/extended_affine_weyl_group.py +9 -9
  76. sage/combinat/root_system/fundamental_group.py +3 -5
  77. sage/combinat/root_system/hecke_algebra_representation.py +1 -1
  78. sage/combinat/root_system/integrable_representations.py +1 -1
  79. sage/combinat/root_system/pieri_factors.py +3 -3
  80. sage/combinat/root_system/root_lattice_realization_algebras.py +1 -1
  81. sage/combinat/root_system/root_lattice_realizations.py +1 -1
  82. sage/combinat/root_system/type_folded.py +3 -3
  83. sage/combinat/root_system/type_reducible.py +8 -7
  84. sage/combinat/root_system/type_super_A.py +2 -2
  85. sage/combinat/root_system/weight_lattice_realizations.py +9 -8
  86. sage/combinat/root_system/weyl_characters.py +2 -2
  87. sage/crypto/__init__.py +1 -0
  88. sage/crypto/block_cipher/des.py +1 -1
  89. sage/crypto/block_cipher/miniaes.py +3 -3
  90. sage/crypto/block_cipher/present.py +3 -3
  91. sage/crypto/block_cipher/sdes.py +3 -3
  92. sage/crypto/boolean_function.cpython-310-darwin.so +0 -0
  93. sage/crypto/boolean_function.pyx +22 -23
  94. sage/crypto/key_exchange/diffie_hellman.py +4 -9
  95. sage/crypto/mq/sr.py +1 -1
  96. sage/crypto/public_key/blum_goldwasser.py +3 -3
  97. sage/crypto/sbox.cpython-310-darwin.so +0 -0
  98. sage/crypto/sbox.pyx +1 -1
  99. sage/crypto/sboxes.py +22 -0
  100. sage/crypto/util.py +4 -6
  101. sage/ext/interpreters/__init__.py +1 -1
  102. sage/ext/interpreters/all__sagemath_modules.py +1 -1
  103. sage/ext/interpreters/wrapper_cc.cpython-310-darwin.so +0 -0
  104. sage/ext/interpreters/wrapper_cc.pxd +5 -5
  105. sage/ext/interpreters/wrapper_cc.pyx +1 -1
  106. sage/ext/interpreters/wrapper_cdf.cpython-310-darwin.so +0 -0
  107. sage/ext/interpreters/wrapper_cdf.pxd +5 -7
  108. sage/ext/interpreters/wrapper_cdf.pyx +4 -10
  109. sage/ext/interpreters/wrapper_rdf.cpython-310-darwin.so +0 -0
  110. sage/ext/interpreters/wrapper_rdf.pxd +1 -1
  111. sage/ext/interpreters/wrapper_rdf.pyx +1 -1
  112. sage/ext/interpreters/wrapper_rr.cpython-310-darwin.so +0 -0
  113. sage/ext/interpreters/wrapper_rr.pxd +5 -5
  114. sage/ext/interpreters/wrapper_rr.pyx +1 -2
  115. sage/geometry/toric_lattice.py +3 -3
  116. sage/geometry/toric_lattice_element.cpython-310-darwin.so +0 -0
  117. sage/groups/additive_abelian/additive_abelian_group.py +1 -1
  118. sage/groups/additive_abelian/qmodnz.py +4 -4
  119. sage/groups/matrix_gps/coxeter_group.py +17 -4
  120. sage/groups/matrix_gps/group_element.cpython-310-darwin.so +0 -0
  121. sage/groups/misc_gps/argument_groups.py +2 -2
  122. sage/groups/misc_gps/imaginary_groups.py +4 -4
  123. sage/groups/perm_gps/partn_ref/refinement_binary.cpython-310-darwin.so +0 -0
  124. sage/groups/perm_gps/partn_ref/refinement_matrices.cpython-310-darwin.so +0 -0
  125. sage/homology/chain_complex.py +0 -2
  126. sage/homology/hochschild_complex.py +3 -3
  127. sage/homology/homology_morphism.py +6 -6
  128. sage/homology/homology_vector_space_with_basis.py +1 -1
  129. sage/libs/gsl/array.cpython-310-darwin.so +0 -0
  130. sage/libs/mpmath/utils.cpython-310-darwin.so +0 -0
  131. sage/matrix/action.cpython-310-darwin.so +0 -0
  132. sage/matrix/args.cpython-310-darwin.so +0 -0
  133. sage/matrix/args.pyx +25 -10
  134. sage/matrix/benchmark.py +8 -4
  135. sage/matrix/compute_J_ideal.py +2 -2
  136. sage/matrix/constructor.cpython-310-darwin.so +0 -0
  137. sage/matrix/echelon_matrix.cpython-310-darwin.so +0 -0
  138. sage/matrix/echelon_matrix.pyx +1 -1
  139. sage/matrix/matrix0.cpython-310-darwin.so +0 -0
  140. sage/matrix/matrix0.pxd +3 -3
  141. sage/matrix/matrix0.pyx +7 -5
  142. sage/matrix/matrix1.cpython-310-darwin.so +0 -0
  143. sage/matrix/matrix1.pyx +87 -48
  144. sage/matrix/matrix2.cpython-310-darwin.so +0 -0
  145. sage/matrix/matrix2.pxd +3 -3
  146. sage/matrix/matrix2.pyx +1261 -63
  147. sage/matrix/matrix_cdv.cpython-310-darwin.so +0 -0
  148. sage/matrix/matrix_complex_double_dense.cpython-310-darwin.so +0 -0
  149. sage/matrix/matrix_complex_double_dense.pyx +1 -1
  150. sage/matrix/matrix_dense.cpython-310-darwin.so +0 -0
  151. sage/matrix/matrix_dense.pyx +2 -3
  152. sage/matrix/matrix_double_dense.cpython-310-darwin.so +0 -0
  153. sage/matrix/matrix_double_dense.pyx +11 -5
  154. sage/matrix/matrix_double_sparse.cpython-310-darwin.so +0 -0
  155. sage/matrix/matrix_generic_dense.cpython-310-darwin.so +0 -0
  156. sage/matrix/matrix_generic_sparse.cpython-310-darwin.so +0 -0
  157. sage/matrix/matrix_generic_sparse.pyx +1 -1
  158. sage/matrix/matrix_laurent_mpolynomial_dense.cpython-310-darwin.so +0 -0
  159. sage/matrix/matrix_numpy_dense.cpython-310-darwin.so +0 -0
  160. sage/matrix/matrix_numpy_integer_dense.cpython-310-darwin.so +0 -0
  161. sage/matrix/matrix_polynomial_dense.cpython-310-darwin.so +0 -0
  162. sage/matrix/matrix_polynomial_dense.pyx +952 -261
  163. sage/matrix/matrix_real_double_dense.cpython-310-darwin.so +0 -0
  164. sage/matrix/matrix_sparse.cpython-310-darwin.so +0 -0
  165. sage/matrix/matrix_sparse.pyx +6 -7
  166. sage/matrix/matrix_window.cpython-310-darwin.so +0 -0
  167. sage/matrix/matrix_window.pyx +2 -2
  168. sage/matrix/misc_mpfr.cpython-310-darwin.so +0 -0
  169. sage/matrix/operation_table.py +0 -2
  170. sage/matrix/special.py +5 -1
  171. sage/matrix/strassen.cpython-310-darwin.so +0 -0
  172. sage/matrix/strassen.pyx +1 -1
  173. sage/matroids/basis_exchange_matroid.cpython-310-darwin.so +0 -0
  174. sage/matroids/basis_matroid.cpython-310-darwin.so +0 -0
  175. sage/matroids/chow_ring.py +68 -65
  176. sage/matroids/chow_ring_ideal.py +41 -38
  177. sage/matroids/circuit_closures_matroid.cpython-310-darwin.so +0 -0
  178. sage/matroids/circuits_matroid.cpython-310-darwin.so +0 -0
  179. sage/matroids/database_matroids.py +16 -5
  180. sage/matroids/dual_matroid.py +2 -2
  181. sage/matroids/extension.cpython-310-darwin.so +0 -0
  182. sage/matroids/flats_matroid.cpython-310-darwin.so +0 -0
  183. sage/matroids/gammoid.py +1 -1
  184. sage/matroids/graphic_matroid.cpython-310-darwin.so +0 -0
  185. sage/matroids/graphic_matroid.pyx +3 -3
  186. sage/matroids/lean_matrix.cpython-310-darwin.so +0 -0
  187. sage/matroids/lean_matrix.pyx +22 -22
  188. sage/matroids/linear_matroid.cpython-310-darwin.so +0 -0
  189. sage/matroids/linear_matroid.pyx +13 -13
  190. sage/matroids/matroid.cpython-310-darwin.so +0 -0
  191. sage/matroids/matroid.pyx +15 -15
  192. sage/matroids/matroids_plot_helpers.py +48 -46
  193. sage/matroids/minor_matroid.py +2 -2
  194. sage/matroids/set_system.cpython-310-darwin.so +0 -0
  195. sage/matroids/transversal_matroid.cpython-310-darwin.so +0 -0
  196. sage/matroids/transversal_matroid.pyx +3 -3
  197. sage/matroids/union_matroid.cpython-310-darwin.so +0 -0
  198. sage/matroids/union_matroid.pyx +3 -0
  199. sage/matroids/unpickling.cpython-310-darwin.so +0 -0
  200. sage/matroids/utilities.py +2 -2
  201. sage/misc/c3.cpython-310-darwin.so +0 -0
  202. sage/misc/compat.py +1 -2
  203. sage/misc/pickle_old.cpython-310-darwin.so +0 -0
  204. sage/modules/diamond_cutting.py +117 -30
  205. sage/modules/fg_pid/fgp_module.py +3 -3
  206. sage/modules/filtered_vector_space.py +4 -4
  207. sage/modules/finite_submodule_iter.cpython-310-darwin.so +0 -0
  208. sage/modules/fp_graded/free_module.py +2 -2
  209. sage/modules/fp_graded/module.py +2 -2
  210. sage/modules/fp_graded/morphism.py +4 -4
  211. sage/modules/fp_graded/steenrod/morphism.py +1 -1
  212. sage/modules/free_module.py +162 -26
  213. sage/modules/free_module_element.cpython-310-darwin.so +0 -0
  214. sage/modules/free_module_element.pyx +4 -4
  215. sage/modules/free_module_integer.py +2 -2
  216. sage/modules/free_module_morphism.py +3 -3
  217. sage/modules/free_module_pseudohomspace.py +352 -0
  218. sage/modules/free_module_pseudomorphism.py +578 -0
  219. sage/modules/free_quadratic_module_integer_symmetric.py +24 -13
  220. sage/modules/matrix_morphism.py +9 -9
  221. sage/modules/multi_filtered_vector_space.py +4 -4
  222. sage/modules/ore_module.py +2208 -0
  223. sage/modules/ore_module_element.py +178 -0
  224. sage/modules/ore_module_homspace.py +147 -0
  225. sage/modules/ore_module_morphism.py +968 -0
  226. sage/modules/quotient_module.py +11 -1
  227. sage/modules/submodule.py +1 -1
  228. sage/modules/torsion_quadratic_module.py +1 -1
  229. sage/modules/vector_complex_double_dense.cpython-310-darwin.so +0 -0
  230. sage/modules/vector_double_dense.cpython-310-darwin.so +0 -0
  231. sage/modules/vector_integer_dense.cpython-310-darwin.so +0 -0
  232. sage/modules/vector_integer_sparse.cpython-310-darwin.so +0 -0
  233. sage/modules/vector_integer_sparse.pyx +4 -4
  234. sage/modules/vector_modn_dense.cpython-310-darwin.so +0 -0
  235. sage/modules/vector_modn_sparse.cpython-310-darwin.so +0 -0
  236. sage/modules/vector_numpy_dense.cpython-310-darwin.so +0 -0
  237. sage/modules/vector_numpy_integer_dense.cpython-310-darwin.so +0 -0
  238. sage/modules/vector_rational_dense.cpython-310-darwin.so +0 -0
  239. sage/modules/vector_rational_dense.pyx +1 -1
  240. sage/modules/vector_rational_sparse.cpython-310-darwin.so +0 -0
  241. sage/modules/vector_rational_sparse.pyx +5 -5
  242. sage/modules/vector_real_double_dense.cpython-310-darwin.so +0 -0
  243. sage/modules/vector_space_morphism.py +2 -2
  244. sage/modules/with_basis/cell_module.py +17 -0
  245. sage/modules/with_basis/indexed_element.cpython-310-darwin.so +0 -0
  246. sage/modules/with_basis/indexed_element.pyx +1 -1
  247. sage/modules/with_basis/invariant.py +1 -1
  248. sage/modules/with_basis/representation.py +0 -1
  249. sage/modules/with_basis/subquotient.py +2 -2
  250. sage/numerical/gauss_legendre.cpython-310-darwin.so +0 -0
  251. sage/probability/probability_distribution.cpython-310-darwin.so +0 -0
  252. sage/quadratic_forms/binary_qf.py +11 -11
  253. sage/quadratic_forms/bqf_class_group.py +26 -92
  254. sage/quadratic_forms/count_local_2.cpython-310-darwin.so +0 -0
  255. sage/quadratic_forms/extras.py +1 -1
  256. sage/quadratic_forms/quadratic_form.py +5 -4
  257. sage/quadratic_forms/quadratic_form__equivalence_testing.py +7 -4
  258. sage/quadratic_forms/quadratic_form__evaluate.cpython-310-darwin.so +0 -0
  259. sage/quadratic_forms/quadratic_form__local_field_invariants.py +10 -10
  260. sage/quadratic_forms/quadratic_form__ternary_Tornaria.py +2 -2
  261. sage/quadratic_forms/ternary.cpython-310-darwin.so +0 -0
  262. sage/quadratic_forms/ternary_qf.py +50 -83
  263. sage/rings/cfinite_sequence.py +16 -17
  264. sage/rings/complex_conversion.cpython-310-darwin.so +0 -0
  265. sage/rings/complex_double.cpython-310-darwin.so +0 -0
  266. sage/rings/complex_double.pxd +1 -0
  267. sage/rings/complex_double.pyx +37 -32
  268. sage/rings/complex_mpc.cpython-310-darwin.so +0 -0
  269. sage/rings/complex_mpc.pyx +27 -23
  270. sage/rings/complex_mpfr.cpython-310-darwin.so +0 -0
  271. sage/rings/complex_mpfr.pyx +11 -11
  272. sage/rings/function_field/drinfeld_modules/charzero_drinfeld_module.py +277 -21
  273. sage/rings/function_field/drinfeld_modules/drinfeld_module.py +10 -1
  274. sage/rings/function_field/drinfeld_modules/finite_drinfeld_module.py +1 -1
  275. sage/rings/function_field/drinfeld_modules/homset.py +1 -2
  276. sage/rings/function_field/drinfeld_modules/morphism.py +2 -2
  277. sage/rings/function_field/hermite_form_polynomial.cpython-310-darwin.so +0 -0
  278. sage/rings/function_field/khuri_makdisi.cpython-310-darwin.so +0 -0
  279. sage/rings/function_field/khuri_makdisi.pyx +27 -25
  280. sage/rings/invariants/invariant_theory.py +61 -60
  281. sage/rings/invariants/reconstruction.py +8 -8
  282. sage/rings/polynomial/laurent_polynomial_mpair.cpython-310-darwin.so +0 -0
  283. sage/rings/polynomial/ore_function_element.py +1 -1
  284. sage/rings/polynomial/ore_polynomial_element.cpython-310-darwin.so +0 -0
  285. sage/rings/polynomial/ore_polynomial_element.pyx +8 -8
  286. sage/rings/polynomial/ore_polynomial_ring.py +134 -17
  287. sage/rings/polynomial/polynomial_real_mpfr_dense.cpython-310-darwin.so +0 -0
  288. sage/rings/polynomial/skew_polynomial_element.cpython-310-darwin.so +0 -0
  289. sage/rings/polynomial/skew_polynomial_finite_field.cpython-310-darwin.so +0 -0
  290. sage/rings/polynomial/skew_polynomial_finite_field.pyx +3 -4
  291. sage/rings/polynomial/skew_polynomial_finite_order.cpython-310-darwin.so +0 -0
  292. sage/rings/polynomial/skew_polynomial_finite_order.pyx +2 -5
  293. sage/rings/real_double_element_gsl.cpython-310-darwin.so +0 -0
  294. sage/rings/real_mpfr.cpython-310-darwin.so +0 -0
  295. sage/rings/real_mpfr.pyx +25 -7
  296. sage/rings/ring_extension.cpython-310-darwin.so +0 -0
  297. sage/rings/ring_extension.pyx +4 -2
  298. sage/rings/ring_extension_conversion.cpython-310-darwin.so +0 -0
  299. sage/rings/ring_extension_element.cpython-310-darwin.so +0 -0
  300. sage/rings/ring_extension_element.pyx +42 -0
  301. sage/rings/ring_extension_morphism.cpython-310-darwin.so +0 -0
  302. sage/schemes/all__sagemath_modules.py +1 -0
  303. sage/schemes/projective/all__sagemath_modules.py +1 -0
  304. sage/schemes/projective/coherent_sheaf.py +300 -0
  305. sage/schemes/projective/cohomology.py +510 -0
  306. sage/stats/basic_stats.py +17 -15
  307. sage/stats/distributions/dgs_misc.h +11 -4
  308. sage/stats/distributions/discrete_gaussian_integer.cpython-310-darwin.so +0 -0
  309. sage/stats/distributions/discrete_gaussian_integer.pyx +9 -7
  310. sage/stats/hmm/chmm.cpython-310-darwin.so +0 -0
  311. sage/stats/hmm/chmm.pyx +13 -13
  312. sage/stats/hmm/distributions.cpython-310-darwin.so +0 -0
  313. sage/stats/hmm/distributions.pxd +3 -3
  314. sage/stats/hmm/distributions.pyx +3 -3
  315. sage/stats/hmm/hmm.cpython-310-darwin.so +0 -0
  316. sage/stats/hmm/hmm.pxd +3 -3
  317. sage/stats/hmm/hmm.pyx +6 -6
  318. sage/stats/hmm/util.cpython-310-darwin.so +0 -0
  319. sage/stats/hmm/util.pyx +6 -6
  320. sage/stats/intlist.cpython-310-darwin.so +0 -0
  321. sage/stats/intlist.pxd +3 -3
  322. sage/stats/time_series.cpython-310-darwin.so +0 -0
  323. sage/tensor/modules/alternating_contr_tensor.py +3 -3
  324. sage/tensor/modules/comp.py +3 -3
  325. sage/tensor/modules/ext_pow_free_module.py +3 -3
  326. sage/tensor/modules/format_utilities.py +3 -3
  327. sage/tensor/modules/free_module_linear_group.py +3 -3
  328. sage/tensor/modules/free_module_morphism.py +0 -1
  329. sage/tensor/modules/tensor_free_module.py +3 -3
  330. sage/tensor/modules/tensor_free_submodule.py +1 -1
  331. sage/tensor/modules/tensor_free_submodule_basis.py +1 -1
  332. sage/tensor/modules/tensor_with_indices.py +5 -5
  333. passagemath_modules.dylibs/libopenblas_armv8p-r0.3.28.dylib +0 -0
  334. {passagemath_modules-10.5.32.dist-info → passagemath_modules-10.6.20.dist-info}/top_level.txt +0 -0
@@ -31,20 +31,20 @@ AUTHOR:
31
31
  * canonical generation function
32
32
  """
33
33
 
34
- #*****************************************************************************
34
+ # ***************************************************************************
35
35
  # Copyright (C) 2007 Robert L. Miller <rlmillster@gmail.com>
36
36
  #
37
37
  # This program is free software: you can redistribute it and/or modify
38
38
  # it under the terms of the GNU General Public License as published by
39
39
  # the Free Software Foundation, either version 2 of the License, or
40
40
  # (at your option) any later version.
41
- # http://www.gnu.org/licenses/
42
- #*****************************************************************************
41
+ # https://www.gnu.org/licenses/
42
+ # ***************************************************************************
43
43
 
44
44
  from libc.string cimport memcpy
45
45
  from cpython.mem cimport *
46
46
  from cpython.object cimport PyObject_RichCompare
47
- from cysignals.memory cimport sig_malloc, sig_realloc, sig_free
47
+ from cysignals.memory cimport sig_malloc, sig_free
48
48
 
49
49
  from sage.structure.element cimport Matrix
50
50
  from sage.misc.timing import cputime
@@ -70,7 +70,7 @@ cdef inline int min(int a, int b) noexcept:
70
70
  cdef int *hamming_weights() noexcept:
71
71
  cdef int *ham_wts
72
72
  cdef int i
73
- ham_wts = <int *> sig_malloc( 65536 * sizeof(int) )
73
+ ham_wts = <int *> sig_malloc(65536 * sizeof(int))
74
74
  if ham_wts is NULL:
75
75
  sig_free(ham_wts)
76
76
  raise MemoryError("Memory.")
@@ -132,7 +132,8 @@ def weight_dist(M):
132
132
  bitset_zero(&basis[i])
133
133
  for j in M.row(i).nonzero_positions():
134
134
  bitset_set(&basis[i], j)
135
- for i from 0 <= i < deg+1: LL[i] = 0
135
+ for i in range(deg + 1):
136
+ LL[i] = 0
136
137
  bitset_init(word, deg)
137
138
  bitset_zero(word)
138
139
  i = 0
@@ -142,12 +143,13 @@ def weight_dist(M):
142
143
  i ^= 1
143
144
  k = 0
144
145
  if not i:
145
- while not j & (1 << k): k += 1
146
+ while not j & (1 << k):
147
+ k += 1
146
148
  k += 1
147
- if k == dim: break
148
- else:
149
- j ^= (1 << k)
150
- bitset_xor(word, word, &basis[k])
149
+ if k == dim:
150
+ break
151
+ j ^= (1 << k)
152
+ bitset_xor(word, word, &basis[k])
151
153
  bitset_free(word)
152
154
  L = [int(LL[i]) for i from 0 <= i < deg+1]
153
155
  for i from 0 <= i < dim:
@@ -287,7 +289,7 @@ cdef WordPermutation *create_word_perm(object list_perm) noexcept:
287
289
  cdef int i, j, parity, comb, words_per_chunk, num_chunks = 1
288
290
  cdef codeword *images_i
289
291
  cdef codeword image
290
- cdef WordPermutation *word_perm = <WordPermutation *> sig_malloc( sizeof(WordPermutation) )
292
+ cdef WordPermutation *word_perm = <WordPermutation *> sig_malloc(sizeof(WordPermutation))
291
293
  if word_perm is NULL:
292
294
  raise RuntimeError("Error allocating memory.")
293
295
  word_perm.degree = len(list_perm)
@@ -300,7 +302,7 @@ cdef WordPermutation *create_word_perm(object list_perm) noexcept:
300
302
  raise RuntimeError("Error allocating memory.")
301
303
  word_perm.chunk_num = num_chunks
302
304
  words_per_chunk = 1 << chunk_size
303
- word_perm.gate = ( (<codeword>1) << chunk_size ) - 1
305
+ word_perm.gate = ((<codeword>1) << chunk_size) - 1
304
306
  list_perm += list(range(len(list_perm), chunk_size*num_chunks))
305
307
  word_perm.chunk_words = words_per_chunk
306
308
  for i from 0 <= i < num_chunks:
@@ -322,12 +324,13 @@ cdef WordPermutation *create_word_perm(object list_perm) noexcept:
322
324
  parity ^= 1
323
325
  j = 0
324
326
  if not parity:
325
- while not comb & (1 << j): j += 1
327
+ while not comb & (1 << j):
328
+ j += 1
326
329
  j += 1
327
- if j == chunk_size: break
328
- else:
329
- comb ^= (1 << j)
330
- image ^= images_i[1 << j]
330
+ if j == chunk_size:
331
+ break
332
+ comb ^= (1 << j)
333
+ image ^= images_i[1 << j]
331
334
  return word_perm
332
335
 
333
336
  cdef WordPermutation *create_array_word_perm(int *array, int start, int degree) noexcept:
@@ -337,7 +340,7 @@ cdef WordPermutation *create_array_word_perm(int *array, int start, int degree)
337
340
  cdef int i, j, cslim, parity, comb, words_per_chunk, num_chunks = 1
338
341
  cdef codeword *images_i
339
342
  cdef codeword image
340
- cdef WordPermutation *word_perm = <WordPermutation *> sig_malloc( sizeof(WordPermutation) )
343
+ cdef WordPermutation *word_perm = <WordPermutation *> sig_malloc(sizeof(WordPermutation))
341
344
  if word_perm is NULL:
342
345
  raise RuntimeError("Error allocating memory.")
343
346
  word_perm.degree = degree
@@ -349,7 +352,7 @@ cdef WordPermutation *create_array_word_perm(int *array, int start, int degree)
349
352
  raise RuntimeError("Error allocating memory.")
350
353
  word_perm.chunk_num = num_chunks
351
354
  words_per_chunk = 1 << chunk_size
352
- word_perm.gate = ( (<codeword>1) << chunk_size ) - 1
355
+ word_perm.gate = ((<codeword>1) << chunk_size) - 1
353
356
  word_perm.chunk_words = words_per_chunk
354
357
  for i from 0 <= i < num_chunks:
355
358
  images_i = <codeword *> sig_malloc(words_per_chunk * sizeof(codeword))
@@ -371,12 +374,13 @@ cdef WordPermutation *create_array_word_perm(int *array, int start, int degree)
371
374
  parity ^= 1
372
375
  j = 0
373
376
  if not parity:
374
- while not comb & (1 << j): j += 1
377
+ while not comb & (1 << j):
378
+ j += 1
375
379
  j += 1
376
- if j == chunk_size: break
377
- else:
378
- comb ^= (1 << j)
379
- image ^= images_i[1 << j]
380
+ if j == chunk_size:
381
+ break
382
+ comb ^= (1 << j)
383
+ image ^= images_i[1 << j]
380
384
  return word_perm
381
385
 
382
386
  cdef WordPermutation *create_id_word_perm(int degree) noexcept:
@@ -386,7 +390,7 @@ cdef WordPermutation *create_id_word_perm(int degree) noexcept:
386
390
  cdef int i, j, parity, comb, words_per_chunk, num_chunks = 1
387
391
  cdef codeword *images_i
388
392
  cdef codeword image
389
- cdef WordPermutation *word_perm = <WordPermutation *> sig_malloc( sizeof(WordPermutation) )
393
+ cdef WordPermutation *word_perm = <WordPermutation *> sig_malloc(sizeof(WordPermutation))
390
394
  if word_perm is NULL:
391
395
  raise RuntimeError("Error allocating memory.")
392
396
  word_perm.degree = degree
@@ -398,7 +402,7 @@ cdef WordPermutation *create_id_word_perm(int degree) noexcept:
398
402
  raise RuntimeError("Error allocating memory.")
399
403
  word_perm.chunk_num = num_chunks
400
404
  words_per_chunk = 1 << chunk_size
401
- word_perm.gate = ( (<codeword>1) << chunk_size ) - 1
405
+ word_perm.gate = ((<codeword>1) << chunk_size) - 1
402
406
  word_perm.chunk_words = words_per_chunk
403
407
  for i from 0 <= i < num_chunks:
404
408
  images_i = <codeword *> sig_malloc(words_per_chunk * sizeof(codeword))
@@ -419,12 +423,13 @@ cdef WordPermutation *create_id_word_perm(int degree) noexcept:
419
423
  parity ^= 1
420
424
  j = 0
421
425
  if not parity:
422
- while not comb & (1 << j): j += 1
426
+ while not comb & (1 << j):
427
+ j += 1
423
428
  j += 1
424
- if j == chunk_size: break
425
- else:
426
- comb ^= (1 << j)
427
- image ^= images_i[1 << j]
429
+ if j == chunk_size:
430
+ break
431
+ comb ^= (1 << j)
432
+ image ^= images_i[1 << j]
428
433
  return word_perm
429
434
 
430
435
  cdef WordPermutation *create_comp_word_perm(WordPermutation *g, WordPermutation *h) noexcept:
@@ -434,7 +439,7 @@ cdef WordPermutation *create_comp_word_perm(WordPermutation *g, WordPermutation
434
439
  cdef int i, j, parity, comb, words_per_chunk, num_chunks = 1
435
440
  cdef codeword *images_i
436
441
  cdef codeword image
437
- cdef WordPermutation *word_perm = <WordPermutation *> sig_malloc( sizeof(WordPermutation) )
442
+ cdef WordPermutation *word_perm = <WordPermutation *> sig_malloc(sizeof(WordPermutation))
438
443
  if word_perm is NULL:
439
444
  raise RuntimeError("Error allocating memory.")
440
445
  word_perm.degree = g.degree
@@ -446,7 +451,7 @@ cdef WordPermutation *create_comp_word_perm(WordPermutation *g, WordPermutation
446
451
  raise RuntimeError("Error allocating memory.")
447
452
  word_perm.chunk_num = num_chunks
448
453
  words_per_chunk = 1 << chunk_size
449
- word_perm.gate = ( (<codeword>1) << chunk_size ) - 1
454
+ word_perm.gate = ((<codeword>1) << chunk_size) - 1
450
455
  word_perm.chunk_words = words_per_chunk
451
456
  for i from 0 <= i < num_chunks:
452
457
  images_i = <codeword *> sig_malloc(words_per_chunk * sizeof(codeword))
@@ -457,7 +462,7 @@ cdef WordPermutation *create_comp_word_perm(WordPermutation *g, WordPermutation
457
462
  sig_free(word_perm)
458
463
  raise RuntimeError("Error allocating memory.")
459
464
  word_perm.images[i] = images_i
460
- for j from 0 <= j < chunk_size:
465
+ for j in range(chunk_size):
461
466
  image = (<codeword>1) << (chunk_size*i + j)
462
467
  image = permute_word_by_wp(h, image)
463
468
  image = permute_word_by_wp(g, image)
@@ -470,12 +475,13 @@ cdef WordPermutation *create_comp_word_perm(WordPermutation *g, WordPermutation
470
475
  parity ^= 1
471
476
  j = 0
472
477
  if not parity:
473
- while not comb & (1 << j): j += 1
478
+ while not comb & (1 << j):
479
+ j += 1
474
480
  j += 1
475
- if j == chunk_size: break
476
- else:
477
- comb ^= (1 << j)
478
- image ^= images_i[1 << j]
481
+ if j == chunk_size:
482
+ break
483
+ comb ^= (1 << j)
484
+ image ^= images_i[1 << j]
479
485
  return word_perm
480
486
 
481
487
  cdef WordPermutation *create_inv_word_perm(WordPermutation *g) noexcept:
@@ -483,7 +489,7 @@ cdef WordPermutation *create_inv_word_perm(WordPermutation *g) noexcept:
483
489
  Create the inverse `g^{-1}` of the word permutation of `g`.
484
490
  """
485
491
  cdef int i, j
486
- cdef int *array = <int *> sig_malloc( g.degree * sizeof(int) )
492
+ cdef int *array = <int *> sig_malloc(g.degree * sizeof(int))
487
493
  cdef codeword temp
488
494
  cdef WordPermutation *w
489
495
  for i from 0 <= i < g.degree:
@@ -591,10 +597,10 @@ cdef codeword *expand_to_ortho_basis(BinaryCode B, int n) noexcept:
591
597
  # assumes B is already in standard form
592
598
  cdef codeword *basis
593
599
  cdef codeword word = 0, temp, new, pivots = 0, combo, parity
594
- cdef codeword n_gate = (~<codeword>0) >> ( (sizeof(codeword)<<3) - n)
595
- cdef int i, j, m, k = B.nrows, dead, d
600
+ cdef codeword n_gate = (~<codeword>0) >> ((sizeof(codeword)<<3) - n)
601
+ cdef int i, j, m, k = B.nrows
596
602
  cdef WordPermutation *wp
597
- basis = <codeword *> sig_malloc( (n+1) * sizeof(codeword) )
603
+ basis = <codeword *> sig_malloc((n + 1) * sizeof(codeword))
598
604
  if basis is NULL:
599
605
  raise MemoryError()
600
606
  for i from 0 <= i < k:
@@ -690,9 +696,11 @@ cdef codeword *expand_to_ortho_basis(BinaryCode B, int n) noexcept:
690
696
  parity ^= 1
691
697
  j = 0
692
698
  if not parity:
693
- while not combo & (1 << j): j += 1
699
+ while not combo & (1 << j):
700
+ j += 1
694
701
  j += 1
695
- if j == B.nrows: break
702
+ if j == B.nrows:
703
+ break
696
704
  else:
697
705
  combo ^= (1 << j)
698
706
  word ^= B.basis[j]
@@ -807,9 +815,11 @@ cdef class BinaryCode:
807
815
  parity ^= 1
808
816
  j = 0
809
817
  if not parity:
810
- while not combination & (1 << j): j += 1
818
+ while not combination & (1 << j):
819
+ j += 1
811
820
  j += 1
812
- if j == nrows: break
821
+ if j == nrows:
822
+ break
813
823
  else:
814
824
  combination ^= (1 << j)
815
825
  word ^= self_basis[j]
@@ -987,7 +997,7 @@ cdef class BinaryCode:
987
997
  b.append('\n')
988
998
  s += ''.join(b)
989
999
 
990
- def __repr__(self):
1000
+ def __repr__(self) -> str:
991
1001
  """
992
1002
  String representation of ``self``.
993
1003
 
@@ -1004,9 +1014,10 @@ cdef class BinaryCode:
1004
1014
  [00001111]
1005
1015
  [10101010]
1006
1016
  """
1007
- cdef int i, j
1008
- s = 'Binary [%d,%d] linear code, generator matrix\n'%(self.ncols, self.nrows)
1009
- for i from 0 <= i < self.nrows:
1017
+ cdef int i
1018
+ s = 'Binary [%d,%d] linear code, generator matrix\n' % (
1019
+ self.ncols, self.nrows)
1020
+ for i in range(self.nrows):
1010
1021
  s += '[' + self._word((<codeword> 1)<<i) + ']\n'
1011
1022
  return s
1012
1023
 
@@ -1029,10 +1040,8 @@ cdef class BinaryCode:
1029
1040
  Note that behavior under input which does not represent a word in
1030
1041
  the code is unspecified (gives nonsense).
1031
1042
  """
1032
- s = ''
1033
- for j from 0 <= j < self.ncols:
1034
- s += '%d'%self.is_one(coords,j)
1035
- return s
1043
+ return ''.join('%d' % self.is_one(coords, j)
1044
+ for j in range(self.ncols))
1036
1045
 
1037
1046
  def _is_one(self, word, col):
1038
1047
  """
@@ -1096,8 +1105,10 @@ cdef class BinaryCode:
1096
1105
  _word_gamma = <int *> sig_malloc(self.nwords * sizeof(int))
1097
1106
  _col_gamma = <int *> sig_malloc(self.ncols * sizeof(int))
1098
1107
  if _col_gamma is NULL or _word_gamma is NULL:
1099
- if _word_gamma is not NULL: sig_free(_word_gamma)
1100
- if _col_gamma is not NULL: sig_free(_col_gamma)
1108
+ if _word_gamma is not NULL:
1109
+ sig_free(_word_gamma)
1110
+ if _col_gamma is not NULL:
1111
+ sig_free(_col_gamma)
1101
1112
  raise MemoryError("Memory.")
1102
1113
  for i from 0 <= i < self.nwords:
1103
1114
  _word_gamma[i] = word_gamma[i]
@@ -1185,9 +1196,11 @@ cdef class BinaryCode:
1185
1196
  parity ^= 1
1186
1197
  j = 0
1187
1198
  if not parity:
1188
- while not combination & (1 << j): j += 1
1199
+ while not combination & (1 << j):
1200
+ j += 1
1189
1201
  j += 1
1190
- if j == self.nrows: break
1202
+ if j == self.nrows:
1203
+ break
1191
1204
  else:
1192
1205
  combination ^= (1 << j)
1193
1206
  word ^= self.basis[j]
@@ -1310,22 +1323,23 @@ cdef class OrbitPartition:
1310
1323
  """
1311
1324
  cdef int i
1312
1325
  cdef int j
1313
- s = 'OrbitPartition on %d words and %d columns. Data:\n'%(self.nwords, self.ncols)
1326
+ s = 'OrbitPartition on %d words and %d columns. Data:\n' % (self.nwords,
1327
+ self.ncols)
1314
1328
  # s += 'Parents::\n'
1315
1329
  s += 'Words:\n'
1316
1330
  for i from 0 <= i < self.nwords:
1317
- s += '%d,'%self.wd_parent[i]
1331
+ s += '%d,' % self.wd_parent[i]
1318
1332
  s = s[:-1] + '\nColumns:\n'
1319
1333
  for j from 0 <= j < self.ncols:
1320
- s += '%d,'%self.col_parent[j]
1334
+ s += '%d,' % self.col_parent[j]
1321
1335
  # s = s[:-1] + '\n'
1322
1336
  # s += 'Min Cell Reps::\n'
1323
1337
  # s += 'Words:\n'
1324
1338
  # for i from 0 <= i < self.nwords:
1325
- # s += '%d,'%self.wd_min_cell_rep[i]
1339
+ # s += '%d,' % self.wd_min_cell_rep[i]
1326
1340
  # s = s[:-1] + '\nColumns:\n'
1327
1341
  # for j from 0 <= j < self.ncols:
1328
- # s += '%d,'%self.col_min_cell_rep[j]
1342
+ # s += '%d,' % self.col_min_cell_rep[j]
1329
1343
  return s[:-1]
1330
1344
 
1331
1345
  def _wd_find(self, word):
@@ -1504,8 +1518,10 @@ cdef class OrbitPartition:
1504
1518
  _wd_gamma = <int *> sig_malloc(self.nwords * sizeof(int))
1505
1519
  _col_gamma = <int *> sig_malloc(self.ncols * sizeof(int))
1506
1520
  if _col_gamma is NULL or _wd_gamma is NULL:
1507
- if _wd_gamma is not NULL: sig_free(_wd_gamma)
1508
- if _col_gamma is not NULL: sig_free(_col_gamma)
1521
+ if _wd_gamma is not NULL:
1522
+ sig_free(_wd_gamma)
1523
+ if _col_gamma is not NULL:
1524
+ sig_free(_col_gamma)
1509
1525
  raise MemoryError("Memory.")
1510
1526
  for i from 0 <= i < self.nwords:
1511
1527
  _wd_gamma[i] = wd_gamma[i]
@@ -1519,14 +1535,12 @@ cdef class OrbitPartition:
1519
1535
  cdef int merge_perm(self, int *col_gamma, int *wd_gamma) noexcept:
1520
1536
  cdef int i, gamma_i_root
1521
1537
  cdef int j, gamma_j_root, return_value = 0
1522
- cdef int *self_wd_parent = self.wd_parent
1523
- cdef int *self_col_parent = self.col_parent
1524
- for i from 0 <= i < self.nwords:
1538
+ for i in range(self.nwords):
1525
1539
  gamma_i_root = self.wd_find(wd_gamma[i])
1526
1540
  if gamma_i_root != i:
1527
1541
  return_value = 1
1528
1542
  self.wd_union(i, gamma_i_root)
1529
- for j from 0 <= j < self.ncols:
1543
+ for j in range(self.ncols):
1530
1544
  gamma_j_root = self.col_find(col_gamma[j])
1531
1545
  if gamma_j_root != j:
1532
1546
  return_value = 1
@@ -1580,16 +1594,16 @@ cdef class PartitionStack:
1580
1594
  self.mem = MemoryAllocator()
1581
1595
  self.wd_ents = <int *> self.mem.malloc(self.nwords * sizeof_int)
1582
1596
  self.wd_lvls = <int *> self.mem.malloc(self.nwords * sizeof_int)
1583
- self.col_ents = <int *> self.mem.malloc(self.ncols * sizeof_int)
1584
- self.col_lvls = <int *> self.mem.malloc(self.ncols * sizeof_int)
1597
+ self.col_ents = <int *> self.mem.malloc(self.ncols * sizeof_int)
1598
+ self.col_lvls = <int *> self.mem.malloc(self.ncols * sizeof_int)
1585
1599
 
1586
1600
  # scratch space
1587
- self.col_degs = <int *> self.mem.malloc( self.ncols * sizeof_int )
1588
- self.col_counts = <int *> self.mem.malloc( self.nwords * sizeof_int )
1589
- self.col_output = <int *> self.mem.malloc( self.ncols * sizeof_int )
1590
- self.wd_degs = <int *> self.mem.malloc( self.nwords * sizeof_int )
1591
- self.wd_counts = <int *> self.mem.malloc( (self.ncols+1) * sizeof_int )
1592
- self.wd_output = <int *> self.mem.malloc( self.nwords * sizeof_int )
1601
+ self.col_degs = <int *> self.mem.malloc(self.ncols * sizeof_int)
1602
+ self.col_counts = <int *> self.mem.malloc(self.nwords * sizeof_int)
1603
+ self.col_output = <int *> self.mem.malloc(self.ncols * sizeof_int)
1604
+ self.wd_degs = <int *> self.mem.malloc(self.nwords * sizeof_int)
1605
+ self.wd_counts = <int *> self.mem.malloc((self.ncols + 1) * sizeof_int)
1606
+ self.wd_output = <int *> self.mem.malloc(self.nwords * sizeof_int)
1593
1607
 
1594
1608
  nwords = self.nwords
1595
1609
  ncols = self.ncols
@@ -1756,7 +1770,7 @@ cdef class PartitionStack:
1756
1770
  s += str(self.basis_locations[i]) + '\n'
1757
1771
  return s
1758
1772
 
1759
- def __repr__(self):
1773
+ def __repr__(self) -> str:
1760
1774
  """
1761
1775
  Return a string representation of ``self``.
1762
1776
 
@@ -1768,18 +1782,19 @@ cdef class PartitionStack:
1768
1782
  sage: P
1769
1783
  ({0,1,2,3}) ({0,1,2,3,4,5})
1770
1784
  """
1771
- cdef int i, j, k
1785
+ cdef int k
1772
1786
  s = ''
1773
1787
  last = ''
1774
1788
  current = ''
1775
- for k from 0 <= k < 2*self.ncols:
1789
+ for k in range(2 * self.ncols):
1776
1790
  current = self._repr_at_k(k)
1777
- if current == last: break
1791
+ if current == last:
1792
+ break
1778
1793
  s += current
1779
1794
  last = current
1780
1795
  return s
1781
1796
 
1782
- def _repr_at_k(self, k):
1797
+ def _repr_at_k(self, k) -> str:
1783
1798
  """
1784
1799
  Give a string representing the partition at level k.
1785
1800
 
@@ -1791,8 +1806,9 @@ cdef class PartitionStack:
1791
1806
  sage: P._repr_at_k(0)
1792
1807
  '({0,1,2,3}) ({0,1,2,3,4,5})\n'
1793
1808
  """
1809
+ cdef int j
1794
1810
  s = '({'
1795
- for j from 0 <= j < self.nwords:
1811
+ for j in range(self.nwords):
1796
1812
  s += str(self.wd_ents[j])
1797
1813
  if self.wd_lvls[j] <= k:
1798
1814
  s += '},{'
@@ -1800,7 +1816,7 @@ cdef class PartitionStack:
1800
1816
  s += ','
1801
1817
  s = s[:-2] + ') '
1802
1818
  s += '({'
1803
- for j from 0 <= j < self.ncols:
1819
+ for j in range(self.ncols):
1804
1820
  s += str(self.col_ents[j])
1805
1821
  if self.col_lvls[j] <= k:
1806
1822
  s += '},{'
@@ -1978,25 +1994,25 @@ cdef class PartitionStack:
1978
1994
  # return reps
1979
1995
  #
1980
1996
  cdef void new_min_cell_reps(self, int k, unsigned int *Omega, int start) noexcept:
1981
- cdef int i, j
1997
+ cdef int i
1982
1998
  cdef int *self_col_lvls = self.col_lvls
1983
1999
  cdef int *self_wd_lvls = self.wd_lvls
1984
2000
  cdef int *self_col_ents = self.col_ents
1985
2001
  cdef int *self_wd_ents = self.wd_ents
1986
- cdef int reps = (1 << self_col_ents[0]), length, word
2002
+ cdef int length, word
1987
2003
  cdef int radix = self.radix, nwords = self.nwords, ncols = self.ncols
1988
2004
  length = 1 + nwords/radix
1989
- if nwords%radix:
2005
+ if nwords % radix:
1990
2006
  length += 1
1991
- for i from 0 <= i < length:
2007
+ for i in range(length):
1992
2008
  Omega[start+i] = 0
1993
- for i from 0 < i < ncols:
2009
+ for i in range(1, ncols):
1994
2010
  Omega[start] += ((self_col_lvls[i-1] <= k) << self_col_ents[i])
1995
2011
  Omega[start+1] = (1 << self_wd_ents[0])
1996
- for i from 0 < i < nwords:
2012
+ for i in range(1, nwords):
1997
2013
  if self_wd_lvls[i-1] <= k:
1998
2014
  word = self_wd_lvls[i-1]
1999
- Omega[start+1+word/radix] += (1 << word%radix)
2015
+ Omega[start+1+word/radix] += (1 << word % radix)
2000
2016
 
2001
2017
  # def _fixed_cols(self, mcrs, k): #TODO
2002
2018
  # """
@@ -2038,7 +2054,7 @@ cdef class PartitionStack:
2038
2054
  # return fixed & mcrs
2039
2055
  #
2040
2056
  cdef void fixed_vertices(self, int k, unsigned int *Phi, unsigned int *Omega, int start) noexcept:
2041
- cdef int i, j, length, ell, fixed = 0
2057
+ cdef int i, length, ell, fixed = 0
2042
2058
  cdef int radix = self.radix, nwords = self.nwords, ncols = self.ncols
2043
2059
  cdef int *self_col_lvls = self.col_lvls
2044
2060
  cdef int *self_wd_lvls = self.wd_lvls
@@ -2049,13 +2065,13 @@ cdef class PartitionStack:
2049
2065
  Phi[start] = fixed & Omega[start]
2050
2066
  # zero out the rest of Phi
2051
2067
  length = 1 + nwords/self.radix
2052
- if nwords%self.radix:
2068
+ if nwords % self.radix:
2053
2069
  length += 1
2054
2070
  for i from 0 < i < length:
2055
2071
  Phi[start+i] = 0
2056
2072
  for i from 0 <= i < nwords:
2057
2073
  ell = self_wd_ents[i]
2058
- Phi[start+1+ell/radix] = ((self_wd_lvls[i] <= k) << ell%radix)
2074
+ Phi[start+1+ell/radix] = ((self_wd_lvls[i] <= k) << ell % radix)
2059
2075
  for i from 0 < i < length:
2060
2076
  Phi[i] &= Omega[i]
2061
2077
 
@@ -2126,7 +2142,8 @@ cdef class PartitionStack:
2126
2142
  min = i - j + 1
2127
2143
  location = j
2128
2144
  j = i + 1
2129
- if self_col_lvls[i] == -1: break
2145
+ if self_col_lvls[i] == -1:
2146
+ break
2130
2147
  i += 1
2131
2148
  # i = 0; j = 0
2132
2149
  # while True:
@@ -2136,20 +2153,22 @@ cdef class PartitionStack:
2136
2153
  # min_is_col = 0
2137
2154
  # location = j
2138
2155
  # j = i + 1
2139
- # if self_wd_lvls[i] == -1: break
2156
+ # if self_wd_lvls[i] == -1:
2157
+ # break
2140
2158
  # i += 1
2141
2159
  # location now points to the beginning of the first, smallest,
2142
2160
  # nontrivial cell
2143
2161
  j = location
2144
2162
  # zero out this level of W:
2145
2163
  ell = 1 + nwords/radix
2146
- if nwords%radix:
2164
+ if nwords % radix:
2147
2165
  ell += 1
2148
2166
  for i from 0 <= i < ell:
2149
2167
  W[start+i] = 0
2150
2168
  if min_is_col:
2151
2169
  while True:
2152
- if self_col_lvls[j] <= k: break
2170
+ if self_col_lvls[j] <= k:
2171
+ break
2153
2172
  j += 1
2154
2173
  # j now points to the last element of the cell
2155
2174
  i = location
@@ -2159,13 +2178,14 @@ cdef class PartitionStack:
2159
2178
  return self_col_ents[location]
2160
2179
  else:
2161
2180
  while True:
2162
- if self_wd_lvls[j] <= k: break
2181
+ if self_wd_lvls[j] <= k:
2182
+ break
2163
2183
  j += 1
2164
2184
  # j now points to the last element of the cell
2165
2185
  i = location
2166
2186
  while i <= j:
2167
2187
  ell = self_wd_ents[i]
2168
- W[start+1+ell/radix] ^= (1 << ell%radix)
2188
+ W[start+1+ell/radix] ^= (1 << ell % radix)
2169
2189
  i += 1
2170
2190
  return self_wd_ents[location] ^ self.flag
2171
2191
 
@@ -2362,14 +2382,17 @@ cdef class PartitionStack:
2362
2382
  ents = self.wd_ents
2363
2383
  lvls = self.wd_lvls
2364
2384
  v = v ^ flag
2365
- while ents[i] != v: i += 1
2385
+ while ents[i] != v:
2386
+ i += 1
2366
2387
  v = v ^ flag
2367
2388
  else:
2368
2389
  ents = self.col_ents
2369
2390
  lvls = self.col_lvls
2370
- while ents[i] != v: i += 1
2391
+ while ents[i] != v:
2392
+ i += 1
2371
2393
  j = i
2372
- while lvls[i] > k: i += 1
2394
+ while lvls[i] > k:
2395
+ i += 1
2373
2396
  if j == 0 or lvls[j-1] <= k:
2374
2397
  if v & self.flag:
2375
2398
  self.wd_percolate(j+1, i)
@@ -2505,7 +2528,7 @@ cdef class PartitionStack:
2505
2528
  return self.sort_cols(start, k)
2506
2529
 
2507
2530
  cdef int sort_cols(self, int start, int k) noexcept:
2508
- cdef int i, j, max, max_location, self_ncols = self.ncols
2531
+ cdef int i, j, max, max_location
2509
2532
  cdef int self_nwords = self.nwords, ii
2510
2533
  cdef int *self_col_counts = self.col_counts
2511
2534
  cdef int *self_col_lvls = self.col_lvls
@@ -2574,7 +2597,7 @@ cdef class PartitionStack:
2574
2597
  return self.sort_wds(start, k)
2575
2598
 
2576
2599
  cdef int sort_wds(self, int start, int k) noexcept:
2577
- cdef int i, j, max, max_location, self_nwords = self.nwords
2600
+ cdef int i, j, max, max_location
2578
2601
  cdef int ii, self_ncols = self.ncols
2579
2602
  cdef int *self_wd_counts = self.wd_counts
2580
2603
  cdef int *self_wd_lvls = self.wd_lvls
@@ -2582,7 +2605,7 @@ cdef class PartitionStack:
2582
2605
  cdef int *self_wd_ents = self.wd_ents
2583
2606
  cdef int *self_wd_output = self.wd_output
2584
2607
 
2585
- for ii from 0 <= ii < self_ncols+1:
2608
+ for ii in range(self_ncols + 1):
2586
2609
  self_wd_counts[ii] = 0
2587
2610
  i = 0
2588
2611
  while self_wd_lvls[i+start] > k:
@@ -2600,7 +2623,8 @@ cdef class PartitionStack:
2600
2623
  self_wd_counts[ii] += self_wd_counts[ii-1]
2601
2624
 
2602
2625
  for j from i >= j >= 0:
2603
- if j > i: break # cython bug with ints...
2626
+ if j > i:
2627
+ break # cython bug with ints...
2604
2628
  self_wd_counts[self_wd_degs[j]] -= 1
2605
2629
  self_wd_output[self_wd_counts[self_wd_degs[j]]] = self_wd_ents[start+j]
2606
2630
 
@@ -2663,7 +2687,7 @@ cdef class PartitionStack:
2663
2687
  ({0},{4},{6},{2},{13},{9},{11},{15},{10},{14},{12},{8},{7},{3},{1},{5}) ({0},{1},{2},{3},{4},{7},{6},{5})
2664
2688
  """
2665
2689
  cdef int i, alpha_length = len(alpha)
2666
- cdef int *_alpha = <int *> sig_malloc( (self.nwords + self.ncols) * sizeof(int) )
2690
+ cdef int *_alpha = <int *> sig_malloc((self.nwords + self.ncols) * sizeof(int))
2667
2691
  cdef int *ham_wts = hamming_weights()
2668
2692
  if _alpha is NULL:
2669
2693
  raise MemoryError("Memory.")
@@ -2679,7 +2703,7 @@ cdef class PartitionStack:
2679
2703
 
2680
2704
  cdef int refine(self, int k, int *alpha, int alpha_length, BinaryCode CG, int *ham_wts) noexcept:
2681
2705
  cdef int q, r, s, t, flag = self.flag, self_ncols = self.ncols
2682
- cdef int t_w, self_nwords = self.nwords, invariant = 0, i, j, m = 0
2706
+ cdef int t_w, invariant = 0, i, j, m = 0
2683
2707
  cdef int *self_wd_degs = self.wd_degs
2684
2708
  cdef int *self_wd_lvls = self.wd_lvls
2685
2709
  cdef int *self_wd_ents = self.wd_ents
@@ -2696,9 +2720,11 @@ cdef class PartitionStack:
2696
2720
  invariant += 8
2697
2721
  while True:
2698
2722
  self_col_degs[i-j] = self.col_degree(CG, self_col_ents[i], alpha[m]^flag, k)
2699
- if s == 0 and self_col_degs[i-j] != self_col_degs[0]: s = 1
2723
+ if s == 0 and self_col_degs[i-j] != self_col_degs[0]:
2724
+ s = 1
2700
2725
  i += 1
2701
- if self_col_lvls[i-1] <= k: break
2726
+ if self_col_lvls[i-1] <= k:
2727
+ break
2702
2728
  if s:
2703
2729
  invariant += 8
2704
2730
  t = self.sort_cols(j, k)
@@ -2716,7 +2742,8 @@ cdef class PartitionStack:
2716
2742
  alpha[alpha_length] = r
2717
2743
  alpha_length += 1
2718
2744
  r += 1
2719
- if r >= i: break
2745
+ if r >= i:
2746
+ break
2720
2747
  invariant += self.col_degree(CG, self_col_ents[i-1], alpha[m]^flag, k)
2721
2748
  invariant += (i-j)
2722
2749
  j = i
@@ -2727,9 +2754,11 @@ cdef class PartitionStack:
2727
2754
  invariant += 64
2728
2755
  while True:
2729
2756
  self_wd_degs[i-j] = self.wd_degree(CG, self_wd_ents[i], alpha[m], k, ham_wts)
2730
- if s == 0 and self_wd_degs[i-j] != self_wd_degs[0]: s = 1
2757
+ if s == 0 and self_wd_degs[i-j] != self_wd_degs[0]:
2758
+ s = 1
2731
2759
  i += 1
2732
- if self_wd_lvls[i-1] <= k: break
2760
+ if self_wd_lvls[i-1] <= k:
2761
+ break
2733
2762
  if s:
2734
2763
  invariant += 64
2735
2764
  t_w = self.sort_wds(j, k)
@@ -2749,7 +2778,8 @@ cdef class PartitionStack:
2749
2778
  alpha[alpha_length] = r^flag
2750
2779
  alpha_length += 1
2751
2780
  r += 1
2752
- if r >= i: break
2781
+ if r >= i:
2782
+ break
2753
2783
  invariant += self.wd_degree(CG, self_wd_ents[i-1], alpha[m], k, ham_wts)
2754
2784
  invariant += (i-j)
2755
2785
  j = i
@@ -2838,11 +2868,9 @@ cdef class PartitionStack:
2838
2868
  sage: Q.cmp(P, B)
2839
2869
  0
2840
2870
  """
2841
- cdef int *self_wd_ents = self.wd_ents
2842
- cdef codeword *CG_words = CG.words
2843
- cdef int i, j, l, m, span = 1, ncols = self.ncols, nwords = self.nwords
2844
- for i from 0 < i < nwords:
2845
- for j from 0 <= j < ncols:
2871
+ cdef int i, j, l, m, ncols = self.ncols, nwords = self.nwords
2872
+ for i in range(1, nwords):
2873
+ for j in range(ncols):
2846
2874
  l = CG.is_one(self.wd_ents[i], self.col_ents[j])
2847
2875
  m = CG.is_one(other.wd_ents[i], other.col_ents[j])
2848
2876
  if l != m:
@@ -2910,7 +2938,6 @@ cdef class PartitionStack:
2910
2938
  0
2911
2939
  11
2912
2940
  """
2913
- cdef int i
2914
2941
  cdef int *ham_wts = hamming_weights()
2915
2942
  self.find_basis(ham_wts)
2916
2943
  sig_free(ham_wts)
@@ -2919,7 +2946,7 @@ cdef class PartitionStack:
2919
2946
  cdef int i = 0, j, k, nwords = self.nwords, weight, basis_elts = 0, nrows = self.nrows
2920
2947
  cdef int *self_wd_ents = self.wd_ents
2921
2948
  if self.basis_locations is NULL:
2922
- self.basis_locations = <int *> sig_malloc( 2 * nrows * sizeof(int) )
2949
+ self.basis_locations = <int *> sig_malloc(2 * nrows * sizeof(int))
2923
2950
  if self.basis_locations is NULL:
2924
2951
  raise MemoryError("Memory.")
2925
2952
  while i < nwords:
@@ -2931,7 +2958,8 @@ cdef class PartitionStack:
2931
2958
  while not (1<<k) & j:
2932
2959
  k += 1
2933
2960
  self.basis_locations[k] = i
2934
- if basis_elts == nrows: break
2961
+ if basis_elts == nrows:
2962
+ break
2935
2963
  i += 1
2936
2964
  for i from 0 <= i < nrows:
2937
2965
  self.basis_locations[nrows + i] = self_wd_ents[1 << i]
@@ -3307,7 +3335,8 @@ cdef class BinaryCodeClassifier:
3307
3335
  alpha[0] = 0
3308
3336
  alpha[1] = nu.flag
3309
3337
  nu.refine(k, alpha, 2, C, ham_wts)
3310
- if nu.sat_225(k): hh = k
3338
+ if nu.sat_225(k):
3339
+ hh = k
3311
3340
  if nu.is_discrete(k):
3312
3341
  state = 18
3313
3342
  continue
@@ -3333,7 +3362,8 @@ cdef class BinaryCodeClassifier:
3333
3362
  continue
3334
3363
 
3335
3364
  # update hzf__h_zeta
3336
- if hzf__h_zeta == k-1 and Lambda[k] == zf__Lambda_zeta[k]: hzf__h_zeta = k
3365
+ if hzf__h_zeta == k-1 and Lambda[k] == zf__Lambda_zeta[k]:
3366
+ hzf__h_zeta = k
3337
3367
  # update qzb
3338
3368
  if qzb == 0:
3339
3369
  if zb__Lambda_rho[k] == -1 or Lambda[k] < zb__Lambda_rho[k]:
@@ -3343,12 +3373,14 @@ cdef class BinaryCodeClassifier:
3343
3373
  else:
3344
3374
  qzb = 0
3345
3375
  # update hzb
3346
- if hzb__h_rho == k-1 and qzb == 0: hzb__h_rho = k
3376
+ if hzb__h_rho == k-1 and qzb == 0:
3377
+ hzb__h_rho = k
3347
3378
  # if Lambda[k] > zb[k], then zb[k] := Lambda[k]
3348
3379
  # (zb keeps track of the indicator invariants corresponding to
3349
3380
  # rho, the closest canonical leaf so far seen- if Lambda is
3350
3381
  # bigger, then rho must be about to change
3351
- if qzb > 0: zb__Lambda_rho[k] = Lambda[k]
3382
+ if qzb > 0:
3383
+ zb__Lambda_rho[k] = Lambda[k]
3352
3384
  state = 3
3353
3385
 
3354
3386
  elif state == 3: # attempt to rule out automorphisms while moving down the tree
@@ -3370,7 +3402,8 @@ cdef class BinaryCodeClassifier:
3370
3402
  # store the first smallest nontrivial cell in W[k], and set v[k]
3371
3403
  # equal to its minimum element
3372
3404
  v[k] = nu.new_first_smallest_nontrivial(k, W, self.Phi_size * k)
3373
- if not nu.sat_225(k): hh = k + 1
3405
+ if not nu.sat_225(k):
3406
+ hh = k + 1
3374
3407
  e[k] = 0 # see state 12 and 17
3375
3408
  state = 2 # continue down the tree
3376
3409
 
@@ -3417,7 +3450,8 @@ cdef class BinaryCodeClassifier:
3417
3450
  # satisfied, which implies that all terminal nodes descended from there are equivalent.
3418
3451
  # If we are looking at such a node, then the partition at nu[hh] can be used for later
3419
3452
  # pruning, so we store its fixed set and a set of representatives of its cells.
3420
- if l < self.L-1: l += 1
3453
+ if l < self.L-1:
3454
+ l += 1
3421
3455
  nu.new_min_cell_reps(hh, Omega, self.Phi_size*l)
3422
3456
  nu.fixed_vertices(hh, Phi, Omega, self.Phi_size*l)
3423
3457
 
@@ -3493,9 +3527,9 @@ cdef class BinaryCodeClassifier:
3493
3527
  for i from 0 <= i < jj:
3494
3528
  Omega[ii+i] = ~0
3495
3529
  Phi[ii+i] = 0
3496
- if nwords%self.radix:
3530
+ if nwords % self.radix:
3497
3531
  jj += 1
3498
- # Omega[ii+jj-1] = ~((1 << nwords%self.radix) - 1)
3532
+ # Omega[ii+jj-1] = ~((1 << nwords % self.radix) - 1)
3499
3533
  # Omega stores the minimum cell representatives
3500
3534
  i = 0
3501
3535
  while i < ncols:
@@ -3511,10 +3545,10 @@ cdef class BinaryCodeClassifier:
3511
3545
  while i < nwords:
3512
3546
  j = word_gamma[i]
3513
3547
  while j != i:
3514
- Omega[ii+1+j/jj] ^= (1<<(j%jj))
3548
+ Omega[ii+1+j/jj] ^= (1<<(j % jj))
3515
3549
  j = word_gamma[j]
3516
3550
  i += 1
3517
- while i < nwords and not Omega[ii+1+i/jj]&(1<<(i%jj)):
3551
+ while i < nwords and not Omega[ii+1+i/jj]&(1<<(i % jj)):
3518
3552
  i += 1
3519
3553
  # Phi stores the columns fixed by the automorphism
3520
3554
  for i from 0 <= i < ncols:
@@ -3522,7 +3556,7 @@ cdef class BinaryCodeClassifier:
3522
3556
  Phi[ii] ^= (1 << i)
3523
3557
  for i from 0 <= i < nwords:
3524
3558
  if word_gamma[i] == i:
3525
- Phi[ii+1+i/jj] ^= (1<<(i%jj))
3559
+ Phi[ii+1+i/jj] ^= (1<<(i % jj))
3526
3560
 
3527
3561
  # Now incorporate the automorphism into Theta
3528
3562
  j = Theta.merge_perm(col_gamma, word_gamma)
@@ -3572,26 +3606,26 @@ cdef class BinaryCodeClassifier:
3572
3606
  ii = self.Phi_size*l
3573
3607
  jj = self.Phi_size*k
3574
3608
  j = 1 + nwords/self.radix
3575
- if nwords%self.radix:
3609
+ if nwords % self.radix:
3576
3610
  j += 1
3577
3611
  W[jj] &= Omega[ii]
3578
3612
  for i from 0 < i < j:
3579
3613
  W[jj+i] &= Omega[ii+i]
3580
3614
  state = 13
3581
3615
 
3582
- elif state == 13: # hub state
3616
+ elif state == 13: # hub state
3583
3617
  if k == -1:
3584
3618
  state = -1
3585
3619
  continue # exit point
3586
3620
 
3587
3621
  if k > h:
3588
3622
  state = 17
3589
- continue # we are still on the same principal branch from zeta
3623
+ continue # we are still on the same principal branch from zeta
3590
3624
 
3591
3625
  if k == h:
3592
3626
  state = 14
3593
- continue # update the stabilizer index and check for new splits,
3594
- # since we have returned to a partition of zeta
3627
+ continue # update the stabilizer index and check for new splits,
3628
+ # since we have returned to a partition of zeta
3595
3629
  # otherwise k < h, hence we have just backtracked up zeta, and are one level closer to done
3596
3630
  h = k
3597
3631
  tvc = 0
@@ -3609,7 +3643,7 @@ cdef class BinaryCodeClassifier:
3609
3643
  # now tvc points to the minimal cell representative of W[k]
3610
3644
  state = 14
3611
3645
 
3612
- elif state == 14: # see if there are any more splits to make from this level of zeta (see state 17)
3646
+ elif state == 14: # see if there are any more splits to make from this level of zeta (see state 17)
3613
3647
  if v[k]&nu.flag == tvc&nu.flag:
3614
3648
  if tvc&nu.flag:
3615
3649
  if Theta.wd_find(v[k]^nu.flag) == Theta.wd_find(tvc^nu.flag):
@@ -3624,7 +3658,7 @@ cdef class BinaryCodeClassifier:
3624
3658
  if v[k]&nu.flag:
3625
3659
  ii = self.radix
3626
3660
  i = (v[k]^nu.flag) + 1
3627
- while i < nwords and not (1 << i%ii) & W[jj+1+i/ii]:
3661
+ while i < nwords and not (1 << i % ii) & W[jj+1+i/ii]:
3628
3662
  i += 1
3629
3663
  if i < nwords:
3630
3664
  v[k] = i^nu.flag
@@ -3653,7 +3687,7 @@ cdef class BinaryCodeClassifier:
3653
3687
  else:
3654
3688
  state = 14
3655
3689
 
3656
- elif state == 15: # split out the column v[k]
3690
+ elif state == 15: # split out the column v[k]
3657
3691
  # hh is smallest such that nu[hh] satisfies Lemma 2.25. If it is larger than k+1,
3658
3692
  # it must be modified, since we are changing that part
3659
3693
  if k + 1 < hh:
@@ -3667,7 +3701,7 @@ cdef class BinaryCodeClassifier:
3667
3701
  qzb = 0
3668
3702
  state = 2
3669
3703
 
3670
- elif state == 16: # backtrack up zeta, updating information about stabilizer vector
3704
+ elif state == 16: # backtrack up zeta, updating information about stabilizer vector
3671
3705
  jj = self.Phi_size*k
3672
3706
  if W[jj]:
3673
3707
  i = W[jj]
@@ -3680,30 +3714,31 @@ cdef class BinaryCodeClassifier:
3680
3714
  iii = W[jj+1+i]
3681
3715
  j += ham_wts[iii & 65535] + ham_wts[(iii >> 16) & 65535]
3682
3716
  i += 1
3683
- if j == index and ht == k + 1: ht = k
3717
+ if j == index and ht == k + 1:
3718
+ ht = k
3684
3719
  self.aut_gp_size *= index
3685
3720
  # (POINT A)
3686
3721
  index = 0
3687
3722
  k -= 1
3688
- if hb > k: # update hb since we are backtracking
3723
+ if hb > k: # update hb since we are backtracking
3689
3724
  hb = k
3690
3725
  state = 13
3691
3726
 
3692
- elif state == 17: # see if there are any more splits to make from this level of nu (and not zeta)
3727
+ elif state == 17: # see if there are any more splits to make from this level of nu (and not zeta)
3693
3728
 
3694
3729
  jjj = self.Phi_size*k
3695
- if e[k] == 0: # now is the time to narrow down W[k] by Omega and Phi
3730
+ if e[k] == 0: # now is the time to narrow down W[k] by Omega and Phi
3696
3731
  # intersect W[k] with each Omega[i] such that v[0]...v[k-1] is in Phi[i]
3697
3732
  jj = self.Phi_size*self.L
3698
3733
  iii = nwords/self.radix
3699
- if nwords%self.radix:
3734
+ if nwords % self.radix:
3700
3735
  iii += 1
3701
3736
  for ii from 0 <= ii < iii:
3702
3737
  Phi[jj+ii] = 0
3703
3738
  for ii from 0 <= ii < k:
3704
3739
  if v[ii]&nu.flag:
3705
3740
  i = v[ii]^nu.flag
3706
- Phi[jj+1+i/self.radix] ^= (1 << i%self.radix)
3741
+ Phi[jj+1+i/self.radix] ^= (1 << i % self.radix)
3707
3742
  else:
3708
3743
  Phi[jj] ^= (1 << v[ii])
3709
3744
  for i from 0 <= i <= l:
@@ -3723,7 +3758,8 @@ cdef class BinaryCodeClassifier:
3723
3758
  i = (v[k]^nu.flag)
3724
3759
  while i < nwords:
3725
3760
  i += 1
3726
- if (1 << i%self.radix) & W[jjj+1+i/self.radix]: break
3761
+ if (1 << i % self.radix) & W[jjj+1+i/self.radix]:
3762
+ break
3727
3763
  if i < nwords:
3728
3764
  v[k] = i^nu.flag
3729
3765
  state = 15
@@ -3732,7 +3768,8 @@ cdef class BinaryCodeClassifier:
3732
3768
  i = v[k]
3733
3769
  while i < ncols:
3734
3770
  i += 1
3735
- if (1 << i) & W[jjj]: break
3771
+ if (1 << i) & W[jjj]:
3772
+ break
3736
3773
  if i < ncols:
3737
3774
  v[k] = i
3738
3775
  state = 15
@@ -3741,11 +3778,11 @@ cdef class BinaryCodeClassifier:
3741
3778
  k -= 1
3742
3779
  state = 13
3743
3780
 
3744
- elif state == 18: # the first time nu becomes a discrete partition: set up zeta, our "identity" leaf
3781
+ elif state == 18: # the first time nu becomes a discrete partition: set up zeta, our "identity" leaf
3745
3782
  # initialize counters for zeta:
3746
- h = k # zeta[h] == nu[h]
3747
- ht = k # nodes descended from zeta[ht] are all equivalent
3748
- hzf__h_zeta = k # max such that indicators for zeta and nu agree
3783
+ h = k # zeta[h] == nu[h]
3784
+ ht = k # nodes descended from zeta[ht] are all equivalent
3785
+ hzf__h_zeta = k # max such that indicators for zeta and nu agree
3749
3786
  zeta = PartitionStack(nu)
3750
3787
  for i from 0 <= i < k:
3751
3788
  self.base[i] = v[i]
@@ -3756,10 +3793,10 @@ cdef class BinaryCodeClassifier:
3756
3793
  k -= 1
3757
3794
  rho = PartitionStack(nu)
3758
3795
  # initialize counters for rho:
3759
- k_rho = k+1 # number of partitions in rho
3760
- hzb__h_rho = k # max such that indicators for rho and nu agree - BDM had k+1
3761
- hb = k # rho[hb] == nu[hb] - BDM had k+1
3762
- qzb = 0 # Lambda[k] == zb[k], so...
3796
+ k_rho = k+1 # number of partitions in rho
3797
+ hzb__h_rho = k # max such that indicators for rho and nu agree - BDM had k+1
3798
+ hb = k # rho[hb] == nu[hb] - BDM had k+1
3799
+ qzb = 0 # Lambda[k] == zb[k], so...
3763
3800
  state = 13
3764
3801
 
3765
3802
  # end big while loop
@@ -3771,7 +3808,7 @@ cdef class BinaryCodeClassifier:
3771
3808
 
3772
3809
  def put_in_canonical_form(self, BinaryCode B):
3773
3810
  """
3774
- Puts the code into canonical form.
3811
+ Put the code into canonical form.
3775
3812
 
3776
3813
  Canonical form is obtained by performing row reduction, permuting the
3777
3814
  pivots to the front so that the generator matrix is of the form: the
@@ -3853,9 +3890,9 @@ cdef class BinaryCodeClassifier:
3853
3890
  sage: soc_iter = codes.databases.self_orthogonal_binary_codes(12, 6, 4)
3854
3891
  sage: L = list(soc_iter)
3855
3892
  sage: for n in range(13):
3856
- ....: s = 'n=%2d : '%n
3893
+ ....: s = 'n=%2d : ' % n
3857
3894
  ....: for k in range(1,7):
3858
- ....: s += '%3d '%len([C for C in L
3895
+ ....: s += '%3d ' % len([C for C in L
3859
3896
  ....: if C.length() == n and C.dimension() == k])
3860
3897
  ....: print(s)
3861
3898
  n= 0 : 0 0 0 0 0 0
@@ -3934,12 +3971,12 @@ cdef class BinaryCodeClassifier:
3934
3971
  num_gens = len(aut_gp_gens)
3935
3972
  base_size = len(base)
3936
3973
 
3937
- parent_generators = <WordPermutation **> sig_malloc( len(aut_gp_gens) * sizeof(WordPermutation*) )
3938
- temp_basis = <codeword *> sig_malloc( self.radix * sizeof(codeword) )
3974
+ parent_generators = <WordPermutation **> sig_malloc(len(aut_gp_gens) * sizeof(WordPermutation*))
3975
+ temp_basis = <codeword *> sig_malloc(self.radix * sizeof(codeword))
3939
3976
 
3940
3977
  output = []
3941
3978
 
3942
- for i from 0 <= i < len(aut_gp_gens):
3979
+ for i in range(len(aut_gp_gens)):
3943
3980
  parent_generators[i] = create_word_perm(aut_gp_gens[i] + list(range(B.ncols, n)))
3944
3981
 
3945
3982
  word = 0
@@ -3958,7 +3995,7 @@ cdef class BinaryCodeClassifier:
3958
3995
  orb_chx_size = 0
3959
3996
  else:
3960
3997
  orb_chx_size = k - log_2_radix
3961
- orbit_checks = <codeword *> sig_malloc( ((<codeword>1) << orb_chx_size) * sizeof(codeword) )
3998
+ orbit_checks = <codeword *> sig_malloc(((<codeword>1) << orb_chx_size) * sizeof(codeword))
3962
3999
  if orbit_checks is NULL:
3963
4000
  raise MemoryError()
3964
4001
  for temp from 0 <= temp < ((<codeword>1) << orb_chx_size):
@@ -3968,12 +4005,12 @@ cdef class BinaryCodeClassifier:
3968
4005
  parity = 0
3969
4006
  gate = (<codeword>1 << B.nrows) - 1
3970
4007
  k_gate = (<codeword>1 << k) - 1
3971
- nonzero_gate = ( (<codeword>1 << (n-B.ncols)) - 1 ) << B.ncols
4008
+ nonzero_gate = ((<codeword>1 << (n-B.ncols)) - 1) << B.ncols
3972
4009
  radix_gate = (((<codeword>1) << log_2_radix) - 1)
3973
4010
 
3974
4011
  while True:
3975
4012
  if nonzero_gate & word == nonzero_gate and \
3976
- (ham_wts[word & 65535] + ham_wts[(word >> 16) & 65535])%d == 0:
4013
+ (ham_wts[word & 65535] + ham_wts[(word >> 16) & 65535]) % d == 0:
3977
4014
  temp = (word >> B.nrows) & ((<codeword>1 << k) - 1)
3978
4015
  if not orbit_checks[temp >> log_2_radix] & ((<codeword>1) << (temp & radix_gate)):
3979
4016
  B_aug = BinaryCode(B, word)
@@ -4064,7 +4101,7 @@ cdef class BinaryCodeClassifier:
4064
4101
  output.append(M)
4065
4102
  dealloc_word_perm(can_lab)
4066
4103
  dealloc_word_perm(can_lab_inv)
4067
- #...
4104
+ # ...
4068
4105
 
4069
4106
  orbits = [word]
4070
4107
  j = 0
@@ -4083,9 +4120,11 @@ cdef class BinaryCodeClassifier:
4083
4120
  parity ^= 1
4084
4121
  i = 0
4085
4122
  if not parity:
4086
- while not combo & (1 << i): i += 1
4123
+ while not combo & (1 << i):
4124
+ i += 1
4087
4125
  i += 1
4088
- if i == k: break
4126
+ if i == k:
4127
+ break
4089
4128
  else:
4090
4129
  combo ^= (1 << i)
4091
4130
  word ^= ortho_basis[i]