Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cmr (Combinatorial Matrix Recognition library) and Cython interface #35801

Draft
wants to merge 262 commits into
base: develop
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
262 commits
Select commit Hold shift + click to select a range
9901da9
src/sage/matrix/matrix_cmr_sparse.pyx: _is_binary_linear_matroid_regu…
mkoeppe Jul 19, 2023
3774045
src/sage/matrix/matrix_cmr_sparse.pyx: Add is_totally_unimodular (fir…
mkoeppe Jul 19, 2023
3e7271c
sage.libs.cmr: Add missing files
mkoeppe Jul 19, 2023
613c566
build/pkgs/sagelib/dependencies: TEMP: Add cmr
mkoeppe Feb 5, 2024
5078766
sage.libs.cmr, sage.matrix.matrix_cmr_sparse: Fix handling of bool fo…
mkoeppe Jul 20, 2023
9424d45
src/sage/matrix/seymour_decomposition.pyx: New (draft)
mkoeppe Jul 20, 2023
c8c95f4
sage.matrix.seymour_decomposition: a bit more work
mkoeppe Jul 20, 2023
c749525
Add example for `is_strongly_unimodular` (#5)
xuluze Jul 21, 2023
b16437e
sage.matrix.seymour_decomposition: Add methods matrix, parent_rows_an…
mkoeppe Jul 22, 2023
8e73911
sage.matrix.matrix_cmr_sparse: Certificate for non-TU
mkoeppe Jul 22, 2023
2da94c6
Add examples for is_k_modular, is_strongly_k_modular (#7)
xuluze Jul 23, 2023
1c1baea
Matrix_integer_dense.is_unimodular: New
mkoeppe Jul 22, 2023
12f1f02
sage.matrix.seymour_decomposition: Add BaseGraphicNode.graph
mkoeppe Jul 23, 2023
e3c2e0a
sage.matrix.seymour_decomposition: Add BaseGraphicNode.forest_edges
mkoeppe Jul 23, 2023
3bf35c9
sage.matrix.seymour_decomposition: Add as_ordered_tree, _ascii_art_, …
mkoeppe Jul 23, 2023
ab75441
Matrix_cmr_chr_sparse._is_binary_linear_matroid_regular: Handle certi…
mkoeppe Jul 23, 2023
daad900
sage.matrix.seymour_decomposition: Add more classes, SpecialLeafNode.…
mkoeppe Jul 23, 2023
faf6172
sage.matrix.matrix_cmr_sparse: Add example
mkoeppe Jul 23, 2023
d47103e
sage.matrix.matrix_cmr_sparse: Add one_sum
mkoeppe Jul 24, 2023
324c60a
sage.matrix.matrix_cmr_sparse: Fixup, more tests for one_sum
mkoeppe Jul 24, 2023
733a20d
src/doc/en/reference/references/index.rst: Add Sch1986
mkoeppe Jul 24, 2023
f6fd9f6
sage.matrix.matrix_cmr_sparse: Add some documentation and tests
mkoeppe Jul 24, 2023
ae4d64a
build/pkgs/cmr/package-version.txt: Update to pick up https://github.…
mkoeppe Jul 24, 2023
1918d70
sage.matrix.{matrix_cmr_sparse,seymour_decomposition}: Add UnknownNod…
mkoeppe Jul 24, 2023
10cb0b1
CMRdecNum{Columns,Rows}: Fix return type, add test
mkoeppe Jul 25, 2023
9fb09b8
build/pkgs/sagemath_cmr, pkgs/sagemath-cmr: New
mkoeppe May 13, 2024
e9f0501
Add all__sagemath_cmr.py files
mkoeppe Jul 25, 2023
c46e0a4
pkgs/sagemath-cmr: Fixups
mkoeppe Jul 25, 2023
cc1e6b9
Matrix_cmr_chr_sparse.is_network_matrix: Implement
mkoeppe Jul 25, 2023
98a0169
src/sage/features/sagemath.py: Add features sage.libs.cmr
mkoeppe Feb 5, 2024
1c74755
src/sage/features/sagemath.py: Fix up
mkoeppe Jul 26, 2023
bd12866
src/sage/libs/cmr/cmr.pxd: Add more declarations
mkoeppe Jul 26, 2023
5a77922
Matrix_cmr_chr_sparse._network_matrix_from_digraph: New
mkoeppe Jul 26, 2023
538b72b
Matrix_cmr_chr_sparse._network_matrix_from_digraph: Fixups
mkoeppe Jul 26, 2023
0b610a2
Matrix_cmr_chr_sparse.is_network_matrix: Add plotting example
mkoeppe Jul 26, 2023
6f0cf0e
sage.matrix.{matrix_cmr_sparse,seymour_decomposition}: Fix object own…
mkoeppe Jul 26, 2023
e7bea15
Add examples to OneSumNode in seymour_decomposition.pyx, add methods …
jsantillan3 Jul 27, 2023
2b8edae
sage.matrix.seymour_decomposition: Another fix for object ownership
mkoeppe Jul 27, 2023
a6a9a8f
sage.matrix.seymour_decomposition: Sort children by parent_rows_and_c…
mkoeppe Jul 27, 2023
4d45090
Add two_sum in matrix_cmr_sparse.pyx (#9)
xuluze Jul 27, 2023
dacaa75
src/sage/matrix/matrix_cmr_sparse.pyx: Mark doctest with incomplete d…
mkoeppe Jul 27, 2023
8eb2c5c
sage.matrix.seymour_decomposition: Show dimensions in repr
mkoeppe Jul 27, 2023
ad8f4bb
Cmr three_sum and cographicnode (#10)
jsantillan3 Aug 1, 2023
0bf6b5c
src/sage/matrix/seymour_decomposition.pyx: Fix doctests
mkoeppe Aug 1, 2023
dae0120
three_sum (#11)
jsantillan3 Aug 12, 2023
0961a0b
Add documentation, copyright headers
mkoeppe Aug 13, 2023
569f679
src/doc/en/reference/references/index.rst: Add Sey1980
mkoeppe Aug 13, 2023
090f7f2
(Temporarily) add new modules to doc
mkoeppe Feb 5, 2024
71443f5
SeriesParallelReductionNode.core, SpecialLeafNode.rep_matrix: New; Ma…
jsantillan3 Aug 30, 2023
f68fd9d
fix doctests
xuluze Nov 15, 2023
753266b
fix doc style
xuluze Nov 15, 2023
05301e6
pkgs/sagemath-cmr/pyproject.toml.m4: Move metadata here from setup.cf…
mkoeppe Nov 16, 2023
94da10f
build/pkgs/cmr: Update to 66a4f9dc17b514f6bdd5bceff41da3bbddb0d119
mkoeppe Nov 16, 2023
ac37135
build/pkgs/cmr/patches/CMRdecNumColumns_Rows_return_type.patch: Remov…
mkoeppe Nov 16, 2023
6e2efb7
src/sage/matrix/matrix_cmr_sparse.pyx: Fix markup
mkoeppe Nov 16, 2023
d8a2f7a
Run ctest once more with more detailed output. (#21)
discopt Nov 30, 2023
eb6f69c
build/pkgs/cmr/dependencies: Remove boost
mkoeppe Dec 11, 2023
553b14d
build/pkgs/cmr: Update to de04ca6f36f81044731360cf336057e77ec60d46 (m…
mkoeppe Dec 11, 2023
e9e2a6d
src/sage/libs/cmr/cmr.pxd: CMR_*_STATISTICS now use uint32_t
mkoeppe Dec 11, 2023
4d16be4
src/sage/libs/cmr/cmr.pxd, src/sage/matrix/matrix_cmr_sparse.pyx: Upd…
mkoeppe Dec 11, 2023
931c82b
src/sage/matrix/matrix_cmr_sparse.pyx: Set CMR_TU_ALGORITHM slot
mkoeppe Dec 11, 2023
95e86a5
build/pkgs/cmr: Update to 9dca928195c4b5bfdb413292eb38e2fb0d388cba
mkoeppe Dec 18, 2023
c22d854
src/sage/libs/cmr: Update
mkoeppe Dec 18, 2023
ecd2172
add matrix_from_rows_and_columns
xuluze Dec 11, 2023
cedec82
add nonzero_block type choice for two sum
mkoeppe Feb 5, 2024
b441c10
add nonzero_block value test
xuluze Dec 12, 2023
74c3852
add doc test and other fix
xuluze Dec 14, 2023
651bdb3
remove CMR_call for CMRsubmatFree
xuluze Dec 14, 2023
72b36cf
fix doc and test for equimodular and strongly equimodular
xuluze Dec 14, 2023
51e2588
add CMR_CALL
xuluze Dec 14, 2023
d0082a4
pkgs/sagemath-cmr/pyproject.toml.m4: Update
mkoeppe Feb 5, 2024
59f97e9
src/sage/matrix/matrix_cmr_sparse.pyx: Use matroids.catalog instead o…
mkoeppe Feb 16, 2024
d79ce1d
add int8_t to characteristic
xuluze Dec 23, 2023
9b12586
src/sage/matrix/seymour_decomposition.pyx: Add OneSumNode.check
mkoeppe Feb 16, 2024
daa3a40
update cmr to 224beac5b4186dc6b3bbcbaf19d8e8ffdd63507a
xuluze Dec 22, 2023
b85fb57
update camion.h
xuluze Feb 22, 2024
9c9a5d6
update equimodular.h
xuluze Feb 22, 2024
638f254
update tu.h matroid.h and delete dec.h
xuluze Feb 22, 2024
6c5bd9c
update ctu.h
xuluze Feb 22, 2024
cfd84df
update graphic.h
xuluze Feb 22, 2024
eec3345
update network.h
xuluze Feb 22, 2024
27030d8
update regular.h
xuluze Feb 22, 2024
7308378
update separation.h
xuluze Feb 23, 2024
cec4559
add balenced.h
xuluze Feb 23, 2024
3dd8947
fix some dec to matroid_dec
xuluze Feb 23, 2024
c64c37b
WIP fix ISSUM
xuluze Feb 23, 2024
ff4769e
WIP
xuluze Feb 23, 2024
e2c523e
WIP
xuluze Feb 23, 2024
94a9cc4
src/sage/libs/cmr/cmr.pxd: Move import from cmr/element.h earlier
mkoeppe Feb 24, 2024
90adcfa
src/sage/libs/cmr/cmr.pxd: Move import from cmr/graph.h earlier
mkoeppe Feb 24, 2024
2b1c639
src/sage/libs/cmr/cmr.pxd: Comment out use of FILE *
mkoeppe Feb 24, 2024
1ad9daf
build/pkgs/cmr/patches: Add https://github.com/discopt/cmr/pull/62 as…
mkoeppe Feb 24, 2024
a02de1f
fix class for node type
xuluze Feb 26, 2024
0f6b2a3
build/pkgs/cmr: Update to 4daea2e5ca6bbe9638c4f4e7dde4d660524608b3
xuluze Feb 26, 2024
4910f3c
fix parameters in tu test (remove construct_matrices) and fix an exam…
xuluze Feb 26, 2024
82d163c
add CompleteDecomposition
xuluze Feb 27, 2024
c50c5fa
fix root dec node with no parent
xuluze Feb 27, 2024
6892f7a
add PivotsNode
xuluze Feb 28, 2024
bd0cae8
add threesum distributed_ranks or concentrated_rank
xuluze Feb 28, 2024
f0cdd85
add binary and ternary pivot
xuluze Feb 28, 2024
2eaca20
fix the output of is_ternary is_distributed_ranks
xuluze Feb 28, 2024
c887abb
three_sum_pivot_children should be False
xuluze Feb 28, 2024
de9a829
add three_sum_cmr
xuluze Feb 29, 2024
c3d6a10
add PivotsNode example
xuluze Feb 29, 2024
659b274
build/pkgs/cmr: Update to 8b0dda14be73d9afc5eeda1461191b2b062072db
xuluze Feb 29, 2024
0ed6c89
change characteristic to MatrixSpace.characteristic()
xuluze Mar 4, 2024
1644a52
build/pkgs/cmr: Update to 33415103202d46b1bd1f4832f83494fbe583bc1b
xuluze Mar 4, 2024
a615193
change size_t to CMR_ELEMENT
xuluze Mar 4, 2024
96b26ca
build/pkgs/cmr: Update to 7abbabe27e9a0a05e5c8f4ae19a2e7c5c8c07bc9
xuluze Mar 5, 2024
b200052
fix row and column indices
xuluze Mar 5, 2024
75e1bb0
add back self._root
xuluze Mar 5, 2024
37f394f
initial attemp to use label for pivot nodes
xuluze Mar 5, 2024
14fe51f
add is_distributed_ranks example
xuluze Mar 7, 2024
ca91075
add two_sum example from cmr
xuluze Mar 7, 2024
1620a7d
fix TwoSumNode block_matrix_form
xuluze Mar 7, 2024
9659b18
WIP three_sum
xuluze Mar 8, 2024
c876dd7
WIP row/col mappings
mkoeppe Mar 8, 2024
c4b8273
WIP
xuluze Mar 8, 2024
9fc5d09
add more test examples
xuluze Mar 8, 2024
32a38a1
add sig_on sig_off to one_sum and two_sum
xuluze Mar 11, 2024
8dfd4fe
add CMR_TU_PARAMS.directCamion
xuluze Mar 11, 2024
d2c5ab7
three_sum_cmr add sig_on
xuluze Mar 11, 2024
0c7bf24
add three_sum_wide_wide
xuluze Mar 11, 2024
041df74
WIP row_keys and column_keys
xuluze Mar 12, 2024
de5a170
WIP
xuluze Mar 12, 2024
b902c38
Fixups
mkoeppe Mar 12, 2024
1edd9e7
WIP
mkoeppe May 13, 2024
05788a2
src/sage/categories/finite_dimensional_modules_with_basis.py: Add Mor…
mkoeppe May 13, 2024
581332f
src/sage/features/sagemath.py: sage.libs.cmr is optional
mkoeppe Mar 13, 2024
1a94771
src/sage/categories/finite_dimensional_modules_with_basis.py: Use fun…
mkoeppe May 13, 2024
22f3395
src/sage/categories/finite_dimensional_modules_with_basis.py (is_*uni…
mkoeppe Mar 13, 2024
7d580fb
src/sage/matrix/matrix_cmr_sparse.pyx: Add row_keys=None, column_keys…
mkoeppe Mar 13, 2024
b4d91dc
src/sage/categories/finite_dimensional_modules_with_basis.py: Add mor…
mkoeppe Mar 13, 2024
b84aba4
src/sage/categories/finite_dimensional_modules_with_basis.py: Add rem…
mkoeppe May 13, 2024
43d7a6f
src/sage/categories/finite_dimensional_modules_with_basis.py: Refacto…
mkoeppe May 13, 2024
3cc19fb
fix a doctest in is_totally_unimodular()
xuluze Mar 13, 2024
f9154f0
src/sage/categories/finite_dimensional_modules_with_basis.py: Catch T…
mkoeppe Mar 13, 2024
3d7b27b
build/pkgs/cmr: Update to 95a2bb7f9343573643f88cd5f60b10a324ad95f3
xuluze Mar 13, 2024
fe00be8
use row_keys and column_keys for PivotsNode
xuluze Mar 13, 2024
e49d849
WIP add three_sum_strategy and keys for Mixed_Mixed
xuluze Mar 13, 2024
528a75a
add Wide_Wide and Mixed_Mixed label for extra row and column
xuluze Mar 13, 2024
ec921e7
build/pkgs/cmr: Update to ac12f7f929f89e6a7b465fa4d45439eab0d9009f
xuluze Mar 13, 2024
79b4790
Add class DecompositionNodeIndexKey
xuluze Mar 16, 2024
1528349
fix doctests
xuluze Mar 16, 2024
c1c4692
build/pkgs/cmr: Update to 5a8fc240b1c3c7807c246ec27bee5246db2e0e1e
xuluze Mar 16, 2024
02d8b76
Rename with ElementKey
xuluze Mar 17, 2024
76a3707
refactored row/column to parent element mapping
xuluze Mar 17, 2024
9040ebc
fix child parent indices refactor
xuluze Mar 17, 2024
b238184
sort keys in the frozenset and add raise ValueError
xuluze Mar 17, 2024
63272cf
change _set_row/column_keys from cdef to def
xuluze Mar 17, 2024
1854a1d
add extra parent_indices besides the parent keys
xuluze Mar 18, 2024
fe70c27
WIP SymbolicNode, DecompositionNode.one_sum
mkoeppe Mar 18, 2024
cd2b779
WIP SymbolicNode, DecompositionNode.one_sum - it builds
mkoeppe Mar 18, 2024
b63b00f
Make _set_{row,column}_keys cdef
mkoeppe Mar 18, 2024
4eae56f
src/sage/matrix/matrix_cmr_sparse.pyx: Handle row/column keys for is_…
mkoeppe Mar 18, 2024
591962f
src/sage/matrix/seymour_decomposition.pyx: Add prototype for methods …
mkoeppe Mar 18, 2024
ff90524
Fixes
mkoeppe Mar 19, 2024
3f80e5b
Another symbolic example
mkoeppe Mar 19, 2024
83f8bb0
Get rid of roots
mkoeppe Mar 19, 2024
4f26d1d
src/sage/categories/finite_dimensional_modules_with_basis.py: Update …
mkoeppe Mar 19, 2024
a29aed2
src/sage/matrix/seymour_decomposition.pyx: Cache matrix explicitly
mkoeppe Mar 19, 2024
29f2469
Set up UnknownNode from a matrix/morphism, replace as_node_with_graph…
mkoeppe Mar 19, 2024
468218f
src/sage/matrix/seymour_decomposition.pyx: Explicit caching in BaseGr…
mkoeppe Mar 19, 2024
b0038fb
Refactor with new helper function _sage_edges
mkoeppe Mar 19, 2024
8af3aa2
Refactor with new helper function _sage_arcs
mkoeppe Mar 19, 2024
111265e
src/sage/matrix/seymour_decomposition.pyx: Fix _class for planar
mkoeppe Mar 19, 2024
5add410
Small edits
mkoeppe Mar 19, 2024
3e6d9fc
Small edits (fixup)
mkoeppe Mar 19, 2024
d795677
Matrix_cmr_chr_sparse.is_graphic(decomposition=True)
mkoeppe Mar 19, 2024
e6e999f
WIP refactor child indices to parent node
xuluze Mar 19, 2024
336140f
Remove _parent_indices and fix doctests to use child_indices
xuluze Mar 19, 2024
f316e06
remove parent_rows_and_columns
xuluze Mar 20, 2024
59924e3
simplify single child indice output
xuluze Mar 20, 2024
e519f59
src/sage/matrix/seymour_decomposition.pyx: Fix up is_graphic
mkoeppe Mar 20, 2024
ccb9443
base ring checks
mkoeppe Mar 20, 2024
137cbd8
Pass base rings through
mkoeppe Mar 21, 2024
fde01ff
ancestor_rows_and_columns: Remove
mkoeppe Mar 21, 2024
7f81017
build/pkgs/cmr: Update to c2c1b7dc2d0adf90ae836fd8776ad14c194afea1
xuluze Apr 4, 2024
cf1e9d7
WIP partial_decomposition
xuluze Apr 5, 2024
21006ae
WIP add test example
xuluze Apr 5, 2024
f62055a
WIP fix indeterminant case
xuluze Apr 5, 2024
bd256b4
fix doctests for partial decomposition
xuluze Apr 5, 2024
37c855e
fix is_cographic doctests
xuluze Apr 5, 2024
b909dbc
add complete_decomposition
xuluze Apr 8, 2024
30f516c
add is_conetwork_matrix
xuluze Apr 8, 2024
9abf8d4
add not determined for graphic/cographic
xuluze Apr 8, 2024
b48faf0
WIP change is_graphic to _is_binary_linear_matroid_graphic
xuluze Apr 11, 2024
9e2d775
WIP change the reference to _is_binary_linear_matroid
xuluze Apr 11, 2024
2128343
WIP add is_network_matrix
xuluze Apr 11, 2024
7111e1b
add doctests and use try except
xuluze Apr 23, 2024
72d7779
change base_ring check for binary matroid
xuluze Apr 23, 2024
d1f17bd
build/pkgs/cmr: Update to edd64258cacab23fe170006bc32f429621652bf0
xuluze Apr 23, 2024
789772b
add methods to set root decomposition node and finish complete decomp…
xuluze Apr 24, 2024
b0e8e2e
build/pkgs/cmr: Update to 63f3e1fbaf52174e25fb95770af439260a4b5631
xuluze May 2, 2024
2c145a8
WIP align treeFlags with cmr
xuluze May 13, 2024
dc6dc38
fix complete decomposition in seymour_decomposition
xuluze May 13, 2024
70d64cf
remove isTernary in _set_root_dec
xuluze May 13, 2024
da9c545
fix base_ring()
xuluze May 13, 2024
b60c666
first try to complete decompositions for is_graphic is_cographic tests
xuluze May 13, 2024
db9d53e
build/pkgs/sagemath_cmr/distros: Remove
mkoeppe Jun 2, 2024
0b62823
build/pkgs/sagemath_cmr/version_requirements.txt: Rename from install…
mkoeppe Jun 2, 2024
03c1b9c
build/pkgs/sagemath_cmr: Install like sagemath_bliss
mkoeppe Jun 2, 2024
d815e58
build/pkgs/cmr: Update to b0a60ad3ce782c59513f016c96e1d08f7d955bee
xuluze Jun 10, 2024
67c7843
update to seymour node in cmr.pxd
xuluze Jun 20, 2024
f951df4
WIP fix interface
xuluze Jun 20, 2024
98744a5
build/pkgs/cmr: Update to fd241e963d244d6ecf9b3f03af59c1e214bd4248
xuluze Jun 20, 2024
72e9d28
delete the key recurse and fix doctests
xuluze Jun 27, 2024
d272ff3
build/pkgs/cmr: Update to b90c33010f51ab631c288b8b6b56e670d5760ce5
xuluze Jun 27, 2024
b8f2077
update cmr and WIP minor
xuluze Jun 27, 2024
231fb19
build/pkgs/cmr: Update to c6ff00c615e6ee0e644912c84fe3c5bc2b5d29e6
xuluze Jul 29, 2024
b846604
Change ZoomSubmat to Slice
xuluze Jul 29, 2024
c604dbe
add algorithm=cmr to is_regular in matroid
mkoeppe Oct 3, 2024
9f4ae3e
change default to algorithm=None in sage.matroids.matroid.is_regular
mkoeppe Oct 3, 2024
bffcbe5
WIP add doctests in matrix_cmr_sparse
xuluze Sep 1, 2024
53014b9
WIP add doctests for three_sum functions
xuluze Sep 2, 2024
1a6cded
add algorithm= to is_graphic in matroid
mkoeppe Oct 3, 2024
8408236
WIP add doctests for pivot functions
xuluze Sep 2, 2024
2501cab
add doctests for matrix_cmr_sparse
xuluze Sep 2, 2024
5354aa3
build/pkgs/cmr: Update to 66b5141ea955c5c43b8d82cf105554b627cd5424
xuluze Sep 2, 2024
b741d6c
update cmr.pxd to 66b5141
xuluze Sep 2, 2024
37a535d
add docstring for parameters in is_totally_unimodular
xuluze Sep 2, 2024
2ad2760
add is_three_sum with sign verification
xuluze Sep 8, 2024
f05511b
rewrite three_sum with added keywords: algorithm, verify, sign_verify
xuluze Sep 9, 2024
6a2b9d6
WIP: add doctests for seymour_decomposition
xuluze Sep 9, 2024
eddb0f9
WIP: add doctests for seymour_decomposition
xuluze Sep 16, 2024
12d0e5d
WIP: add doctests for seymour_decomposition: one_sum and pivot node
xuluze Sep 17, 2024
c5e0b5c
a failed example for three sum mixed mixed
xuluze Sep 17, 2024
abcbaba
build/pkgs/cmr: Update to d6ff9e5d6666b2dc32e2f95b705b4d7b96a265f9
xuluze Sep 17, 2024
78c78c3
WIP: add doctests for seymour_decomposition: complete decomposition a…
xuluze Sep 18, 2024
6b20a5d
WIP: add doctests for seymour_decomposition: R10
xuluze Sep 18, 2024
b5157c5
build/pkgs/cmr: Update to e405fce633c4119a53249a5d0cade8a41fba081e
xuluze Sep 18, 2024
6c51f21
add matroid and isomorphism to R10
xuluze Sep 19, 2024
f978859
add doctests for BaseGraphicNode and include digraph case
xuluze Sep 20, 2024
e2f6192
build/pkgs/googletest: Update to 1.15.2
mkoeppe Oct 3, 2024
3dd7078
build/pkgs/googletest/spkg-configure.m4: New
mkoeppe Oct 13, 2024
e168962
Fix declarations of is_graphic, is_regular, is_valid
mkoeppe Oct 13, 2024
74490ab
src/sage/matroids/linear_matroid.pyx: Fix whitespace
mkoeppe Oct 14, 2024
e16ee2c
src/sage/matrix/seymour_decomposition.pyx: Replace bare except
mkoeppe Oct 14, 2024
0084c33
Docstring markup fixes
mkoeppe Oct 14, 2024
82ec060
src/doc/en/reference/matrices/index.rst: Conditionalize on feature sa…
mkoeppe Oct 14, 2024
92a091c
src/setup.py: Add cmr to optional distribs
mkoeppe Oct 14, 2024
f9bb684
More docstring markup fixes
mkoeppe Oct 14, 2024
0264700
Fix dependencies
mkoeppe Oct 14, 2024
a27128a
src/sage/matrix/seymour_decomposition.pyx: Markup fixes
mkoeppe Oct 14, 2024
9292b0b
build/pkgs/sagemath_cmr/dependencies: Add source files as dependencies
mkoeppe Oct 14, 2024
aff6ca9
More docstring markup fixes
mkoeppe Oct 14, 2024
7527f8e
build/make/Makefile.in (PYPI_WHEEL_PACKAGES): Add sagemath_cmr
mkoeppe Oct 14, 2024
6b701b6
src/sage/misc/sagedoc.py: Add :cmr: role
mkoeppe Oct 14, 2024
7d44d9e
Link to spkg_sagemath_cmr
mkoeppe Oct 14, 2024
442caaa
src/sage/matrix/seymour_decomposition.pyx: Reformat examples
mkoeppe Oct 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Docstring markup fixes
Matthias Koeppe committed Oct 14, 2024
commit 0084c337d3aed0ba3f87bd785df3144fd323d67e
53 changes: 31 additions & 22 deletions src/sage/matrix/matrix_cmr_sparse.pyx
Original file line number Diff line number Diff line change
@@ -2533,9 +2533,9 @@ cdef class Matrix_cmr_chr_sparse(Matrix_cmr_sparse):

.. SEEALSO:: :meth:`binary_pivot`, :meth:`binary_pivots`, :meth:`ternary_pivots`

EXAMPLES::
EXAMPLES:

Single pivot on a `1`-entry:
Single pivot on a `1`-entry::

sage: from sage.matrix.matrix_cmr_sparse import Matrix_cmr_chr_sparse
sage: M = Matrix_cmr_chr_sparse(MatrixSpace(ZZ, 10, 10, sparse=True), [
@@ -2572,7 +2572,7 @@ cdef class Matrix_cmr_chr_sparse(Matrix_cmr_sparse):
[ 1 -1 0 0 0 1 1 -1 1 1]
[ 1 0 0 0 0 -1 0 -1 0 0]

Single pivot on a `-1`-entry:
Single pivot on a `-1`-entry::

sage: M = Matrix_cmr_chr_sparse(MatrixSpace(ZZ, 10, 10, sparse=True), [
....: [-1, 1, 0, 0, 0, -1, 0, 1, 0, 0],
@@ -2744,8 +2744,10 @@ cdef class Matrix_cmr_chr_sparse(Matrix_cmr_sparse):

A matrix `M` of rank `r` is equimodular with determinant gcd `k`
if the following two conditions are satisfied:

- for some column basis `B` of `M`, the greatest common divisor of
the determinants of all `r`-by-`r` submatrices of `B` is `k`;

- the matrix `X` such that `M=BX` is totally unimodular.

OUTPUT:
@@ -2800,8 +2802,10 @@ cdef class Matrix_cmr_chr_sparse(Matrix_cmr_sparse):
the same determinant gcd `k`.
A matrix `M` of rank-`r` is `k`-modular if the following two conditions
are satisfied:

- for some column basis `B` of `M`, the greatest common divisor of the
determinants of all `r`-by-`r` submatrices of `B` is `k`;

- the matrix `X` such that `M=BX` is totally unimodular.

OUTPUT:
@@ -2850,8 +2854,10 @@ cdef class Matrix_cmr_chr_sparse(Matrix_cmr_sparse):

A matrix `M` of rank-`r` is `k`-equimodular if the following two
conditions are satisfied:

- for some column basis `B` of `M`, the greatest common divisor of
the determinants of all `r`-by-`r` submatrices of `B` is `k`;

- the matrix `X` such that `M=BX` is totally unimodular.

If the matrix has full row rank, it is `k`-equimodular if
@@ -3165,19 +3171,21 @@ cdef class Matrix_cmr_chr_sparse(Matrix_cmr_sparse):
def is_network_matrix(self, *, time_limit=60.0, certificate=False,
row_keys=None, column_keys=None):
r"""
Return whether the matrix ``self`` over `\GF{3}` or `QQ` is a network matrix.
Return whether the matrix ``self`` over `\GF{3}` or `\QQ` is a network matrix.
If there is some entry not in `\{-1, 0, 1\}`, return ``False``.

Let `D = (V,A)` be a digraph and let `T` be an (arbitrarily) directed
spanning forest of the underlying undirected graph.
The matrix `M(D,T) \in \{-1,0,1\}^{T \times (A \setminus T)}` defined via
`
M(D,T)_{a,(v,w)} := \begin{cases}
+1 & \text{if the unique $v$-$w$-path in $T$ passes through $a$ forwardly}, \\
-1 & \text{if the unique $v$-$w$-path in $T$ passes through $a$ backwardly}, \\
0 & \text{otherwise}
\end{cases}
`

.. MATH::

M(D,T)_{a,(v,w)} := \begin{cases}
+1 & \text{if the unique $v$-$w$-path in $T$ passes through $a$ forwardly}, \\
-1 & \text{if the unique $v$-$w$-path in $T$ passes through $a$ backwardly}, \\
0 & \text{otherwise}
\end{cases}

is called the network matrix of `D` with respect to `T`.
A matrix `M` is called network matrix if there exists a digraph `D`
with a directed spanning forest `T` such that `M = M(D,T)`.
@@ -3189,7 +3197,7 @@ cdef class Matrix_cmr_chr_sparse(Matrix_cmr_sparse):
the support matrix of `M` for being graphic and
uses camion for testing whether `M` is signed correctly.

EXAMPLES:
EXAMPLES::

sage: from sage.matrix.matrix_cmr_sparse import Matrix_cmr_chr_sparse
sage: M = Matrix_cmr_chr_sparse(MatrixSpace(ZZ, 3, 2, sparse=True),
@@ -3221,11 +3229,11 @@ cdef class Matrix_cmr_chr_sparse(Matrix_cmr_sparse):

sage: from sage.matrix.matrix_cmr_sparse import Matrix_cmr_chr_sparse
sage: K33 = Matrix_cmr_chr_sparse(MatrixSpace(ZZ, 5, 4, sparse=True),
....: [[-1, -1, -1, -1],
....: [ 1, 1, 0, 0],
....: [ 0, 0, 1, 1],
....: [ 1, 0, 1, 0],
....: [ 0, 1, 0, 1]]); K33
....: [[-1, -1, -1, -1],
....: [ 1, 1, 0, 0],
....: [ 0, 0, 1, 1],
....: [ 1, 0, 1, 0],
....: [ 0, 1, 0, 1]]); K33
[-1 -1 -1 -1]
[ 1 1 0 0]
[ 0 0 1 1]
@@ -3612,21 +3620,21 @@ cdef class Matrix_cmr_chr_sparse(Matrix_cmr_sparse):

INPUT:

- ``certificate``: ``False`` or ``True``
If ``True``, then return
- ``certificate`` -- boolean (default: ``False``);
if ``True``, then return
a :class:`DecompositionNode` if ``self`` is totally unimodular;
a submatrix with determinant not in `\{0, \pm1\}` if not.

- ``stop_when_nonTU`` -- boolean (default: ``True``)
- ``stop_when_nonTU`` -- boolean (default: ``True``);
Whether to stop decomposing once not TU is determined.

For a description of other parameters, see :meth:`_set_cmr_seymour_parameters`

- ``row_keys`` -- a finite or enumerated family of arbitrary objects
that index the rows of the matrix
that index the rows of the matrix

- ``column_keys`` -- a finite or enumerated family of arbitrary objects
that index the columns of the matrix
that index the columns of the matrix

EXAMPLES::

@@ -3685,6 +3693,7 @@ cdef class Matrix_cmr_chr_sparse(Matrix_cmr_sparse):

If the matrix is totally unimodular, it always returns
a full decomposition as a certificate::

sage: M = Matrix_cmr_chr_sparse(MatrixSpace(ZZ, 9, 9, sparse=True),
....: [[-1,-1,-1,-1, 0, 0, 0, 0, 0],
....: [1, 1, 0, 0, 0, 0, 0, 0, 0],
48 changes: 25 additions & 23 deletions src/sage/matrix/seymour_decomposition.pyx
Original file line number Diff line number Diff line change
@@ -889,7 +889,7 @@
((((0, 0), (0, 1), (0, 2), (0, 3)), ((0, 'a'), (0, 'b'), (0, 'c'), (0, 'd'))),
(((1, 'a'), (1, 'b')), ((1, 0), (1, 1), (1, 2))))

``row_keys``, ``column_keys`` of ``summands`` are disjoint:
``row_keys``, ``column_keys`` of ``summands`` are disjoint::

sage: from sage.matrix.matrix_cmr_sparse import Matrix_cmr_chr_sparse
sage: from sage.matrix.seymour_decomposition import DecompositionNode
@@ -901,7 +901,8 @@
sage: node = DecompositionNode.one_sum(*certificate.child_nodes())
Traceback (most recent call last):
...
ValueError: keys must be disjoint, got summand_row_keys=('a', 'e'), summand_column_keys=('a', 'b')
ValueError: keys must be disjoint, got
summand_row_keys=('a', 'e'), summand_column_keys=('a', 'b')

sage: result, certificate = M2.is_totally_unimodular(certificate=True,
....: row_keys=range(4),
@@ -911,7 +912,8 @@
....: column_keys='abce')
Traceback (most recent call last):
...
ValueError: inconsistent column_keys, got column_keys=('a', 'b', 'c', 'e'), should be a permutation of ['a', 'b', 'c', 'd']
ValueError: inconsistent column_keys, got column_keys=('a', 'b', 'c', 'e'),
should be a permutation of ['a', 'b', 'c', 'd']
"""
summand_ids = kwds.pop('summand_ids', None)
row_keys = kwds.pop('row_keys', None)
@@ -1829,21 +1831,21 @@

INPUT:

- ``stop_when_nonTU`` -- boolean
Whether to stop decomposing once being non-TU is determined.
- ``stop_when_nonTU`` -- boolean;
whether to stop decomposing once being non-TU is determined.

- ``stop_when_nonnetwork`` -- boolean
Whether to stop decomposing once being non-network is determined.
- ``stop_when_nonnetwork`` -- boolean;
whether to stop decomposing once being non-network is determined.

- ``stop_when_nonconetwork`` -- boolean
Whether to stop decomposing once being non-conetwork is determined.
- ``stop_when_nonconetwork`` -- boolean;
whether to stop decomposing once being non-conetwork is determined.

- ``stop_when_nonnetwork_and_nonconetwork`` -- boolean
Whether to stop decomposing once not being network
and not being conetwork is determined.
- ``stop_when_nonnetwork_and_nonconetwork`` -- boolean;
whether to stop decomposing once not being network
and not being conetwork is determined.

For a description of other parameters, see
:meth:`sage.matrix.matrix_cmr_sparse._set_cmr_seymour_parameters`
For a description of other parameters, see
:meth:`sage.matrix.matrix_cmr_sparse._set_cmr_seymour_parameters`.

EXAMPLES::

@@ -2896,7 +2898,7 @@
sage: C.child_indices()
(((r0, r1, r2, r3), (c0, c1, c2, c3, +r2+r3)),
((+c0+c3, r2, r3, r4, r5), (c0, c3, c4, c5)))
sage: C.block_matrix_form()

Check failure on line 2901 in src/sage/matrix/seymour_decomposition.pyx

GitHub Actions / test-new

Failed example:

Failed example:: Got: [1 0 1 1 0 0] [0 1 1 1 0 0] [1 0 1 0 1 1] [0 1 0 1 1 1] [1 0 1 0 1 0] [0 1 0 1 0 1]
[ 1 0 1 1 0 0]
[ 0 1 1 1 0 0]
[ 1 0 1 0 1 1]
@@ -3013,9 +3015,9 @@
If ``self.base_ring()`` is `\GF{2}`, then return edges.
If ``self.base_ring()`` is `\GF{3}` or `\ZZ`, then arcs.

EXAMPLES::
EXAMPLES:

Undirected graph:
Undirected graph::

sage: from sage.matrix.matrix_cmr_sparse import Matrix_cmr_chr_sparse
sage: M = Matrix_cmr_chr_sparse(MatrixSpace(ZZ, 3, 2, sparse=True),
@@ -3031,7 +3033,7 @@
sage: certificate.coforest_edges()
((2, 7), (1, 12))

Directed graph:
Directed graph::

sage: from sage.matrix.matrix_cmr_sparse import Matrix_cmr_chr_sparse
sage: M = Matrix_cmr_chr_sparse(MatrixSpace(ZZ, 3, 2, sparse=True),
@@ -3143,9 +3145,9 @@
r"""
Actually the cograph of matrix, in the case where it is not graphic.

EXAMPLES::
EXAMPLES:

Undirected graph:
Undirected graph::

sage: from sage.matrix.matrix_cmr_sparse import Matrix_cmr_chr_sparse
sage: M = Matrix_cmr_chr_sparse(MatrixSpace(ZZ, 4, 5, sparse=True),
@@ -3169,7 +3171,7 @@
sage: G.edges(sort=True)
[(0, 2, None), (0, 5, None), (0, 7, None), (1, 2, None), (1, 5, None), (1, 7, None), (2, 8, None), (5, 8, None), (7, 8, None)]

Directed graph:
Directed graph::

sage: from sage.matrix.matrix_cmr_sparse import Matrix_cmr_chr_sparse
sage: M = Matrix_cmr_chr_sparse(MatrixSpace(ZZ, 4, 5, sparse=True),
@@ -3288,9 +3290,9 @@
r"""
Return the cograph of matrix.

EXAMPLES::
EXAMPLES:

Undirected graph:
Undirected graph::

sage: from sage.matrix.matrix_cmr_sparse import Matrix_cmr_chr_sparse
sage: M = Matrix_cmr_chr_sparse(MatrixSpace(ZZ, 3, 2, sparse=True),
@@ -3313,7 +3315,7 @@
sage: certificate.cograph_coforest_edges()
((1, 2), (2, 7), (7, 1))

Directed graph:
Directed graph::

sage: from sage.matrix.matrix_cmr_sparse import Matrix_cmr_chr_sparse
sage: M = Matrix_cmr_chr_sparse(MatrixSpace(ZZ, 3, 2, sparse=True),
4 changes: 2 additions & 2 deletions src/sage/matroids/linear_matroid.pyx
Original file line number Diff line number Diff line change
@@ -3808,8 +3808,8 @@ cdef class BinaryMatroid(LinearMatroid):
to check graphicness:

- ``None`` -- an algorithm based on [GG2012]_.
- ``"cmr"`` -- an algorithm based on [BW1988b]_.
the optional package "cmr" is required.
- ``"cmr"`` -- an algorithm based on [BW1988b]_;
the optional package "cmr" is required.

OUTPUT:


Unchanged files with check annotations Beta

Generic morphism:
From: Free module generated by {'a', 'b'} over Integer Ring
To: Free module generated by {'u', 'v', 'w'} over Integer Ring
sage: M.is_graphic()

Check failure on line 1079 in src/sage/categories/finite_dimensional_modules_with_basis.py

GitHub Actions / test-new

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/sage/src/sage/doctest/forker.py", line 714, in _run self.compile_and_execute(example, compiler, test.globs) File "/sage/src/sage/doctest/forker.py", line 1144, in compile_and_execute exec(compiled, globs) File "<doctest sage.categories.finite_dimensional_modules_with_basis.FiniteDimensionalModulesWithBasis.MorphismMethods.is_graphic[1]>", line 1, in <module> M.is_graphic() File "sage/structure/element.pyx", line 495, in sage.structure.element.Element.__getattr__ return self.getattr_from_category(name) File "sage/structure/element.pyx", line 508, in sage.structure.element.Element.getattr_from_category return getattr_from_other_class(self, cls, name) File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class raise AttributeError(dummy_error_message) AttributeError: 'ModuleMorphismFromMatrix_with_category' object has no attribute 'is_graphic'. Did you mean: 'is_cographic'?
True
sage: result, certificate = M.is_graphic(certificate=True)

Check failure on line 1081 in src/sage/categories/finite_dimensional_modules_with_basis.py

GitHub Actions / test-new

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/sage/src/sage/doctest/forker.py", line 714, in _run self.compile_and_execute(example, compiler, test.globs) File "/sage/src/sage/doctest/forker.py", line 1144, in compile_and_execute exec(compiled, globs) File "<doctest sage.categories.finite_dimensional_modules_with_basis.FiniteDimensionalModulesWithBasis.MorphismMethods.is_graphic[2]>", line 1, in <module> result, certificate = M.is_graphic(certificate=True) File "sage/structure/element.pyx", line 495, in sage.structure.element.Element.__getattr__ return self.getattr_from_category(name) File "sage/structure/element.pyx", line 508, in sage.structure.element.Element.getattr_from_category return getattr_from_other_class(self, cls, name) File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class raise AttributeError(dummy_error_message) AttributeError: 'ModuleMorphismFromMatrix_with_category' object has no attribute 'is_graphic'. Did you mean: 'is_cographic'?
sage: graph, forest_edges, coforest_edges = certificate

Check failure on line 1082 in src/sage/categories/finite_dimensional_modules_with_basis.py

GitHub Actions / test-new

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/sage/src/sage/doctest/forker.py", line 714, in _run self.compile_and_execute(example, compiler, test.globs) File "/sage/src/sage/doctest/forker.py", line 1144, in compile_and_execute exec(compiled, globs) File "<doctest sage.categories.finite_dimensional_modules_with_basis.FiniteDimensionalModulesWithBasis.MorphismMethods.is_graphic[3]>", line 1, in <module> graph, forest_edges, coforest_edges = certificate NameError: name 'certificate' is not defined
sage: graph.vertices(sort=True) # TODO: We should see keys

Check failure on line 1083 in src/sage/categories/finite_dimensional_modules_with_basis.py

GitHub Actions / test-new

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/sage/src/sage/doctest/forker.py", line 714, in _run self.compile_and_execute(example, compiler, test.globs) File "/sage/src/sage/doctest/forker.py", line 1144, in compile_and_execute exec(compiled, globs) File "<doctest sage.categories.finite_dimensional_modules_with_basis.FiniteDimensionalModulesWithBasis.MorphismMethods.is_graphic[4]>", line 1, in <module> graph.vertices(sort=True) # TODO: We should see keys NameError: name 'graph' is not defined
[1, 2, 7, 12]
sage: graph.edges(sort=True, labels=False)

Check failure on line 1085 in src/sage/categories/finite_dimensional_modules_with_basis.py

GitHub Actions / test-new

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/sage/src/sage/doctest/forker.py", line 714, in _run self.compile_and_execute(example, compiler, test.globs) File "/sage/src/sage/doctest/forker.py", line 1144, in compile_and_execute exec(compiled, globs) File "<doctest sage.categories.finite_dimensional_modules_with_basis.FiniteDimensionalModulesWithBasis.MorphismMethods.is_graphic[5]>", line 1, in <module> graph.edges(sort=True, labels=False) NameError: name 'graph' is not defined
[(1, 2), (1, 7), (1, 12), (2, 7), (7, 12)]
sage: forest_edges # indexed by rows of M

Check failure on line 1087 in src/sage/categories/finite_dimensional_modules_with_basis.py

GitHub Actions / test-new

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/sage/src/sage/doctest/forker.py", line 714, in _run self.compile_and_execute(example, compiler, test.globs) File "/sage/src/sage/doctest/forker.py", line 1144, in compile_and_execute exec(compiled, globs) File "<doctest sage.categories.finite_dimensional_modules_with_basis.FiniteDimensionalModulesWithBasis.MorphismMethods.is_graphic[6]>", line 1, in <module> forest_edges # indexed by rows of M NameError: name 'forest_edges' is not defined
{'u': (1, 2), 'v': (7, 1), 'w': (12, 7)}
sage: coforest_edges # indexed by cols of M

Check failure on line 1089 in src/sage/categories/finite_dimensional_modules_with_basis.py

GitHub Actions / test-new

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/sage/src/sage/doctest/forker.py", line 714, in _run self.compile_and_execute(example, compiler, test.globs) File "/sage/src/sage/doctest/forker.py", line 1144, in compile_and_execute exec(compiled, globs) File "<doctest sage.categories.finite_dimensional_modules_with_basis.FiniteDimensionalModulesWithBasis.MorphismMethods.is_graphic[7]>", line 1, in <module> coforest_edges # indexed by cols of M NameError: name 'coforest_edges' is not defined
{'a': (2, 7), 'b': (1, 12)}
"""
try:
From: Free module generated by {'a', 'b', 'c', 'd',
'e', 'f', 'g', 'h', 'i'} over Integer Ring
To: Free module generated by {0, 1, 2, 3} over Integer Ring
sage: M.is_cographic()

Check failure on line 1118 in src/sage/categories/finite_dimensional_modules_with_basis.py

GitHub Actions / test-new

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/sage/src/sage/doctest/forker.py", line 714, in _run self.compile_and_execute(example, compiler, test.globs) File "/sage/src/sage/doctest/forker.py", line 1144, in compile_and_execute exec(compiled, globs) File "<doctest sage.categories.finite_dimensional_modules_with_basis.FiniteDimensionalModulesWithBasis.MorphismMethods.is_cographic[1]>", line 1, in <module> M.is_cographic() File "sage/structure/element.pyx", line 495, in sage.structure.element.Element.__getattr__ return self.getattr_from_category(name) File "sage/structure/element.pyx", line 508, in sage.structure.element.Element.getattr_from_category return getattr_from_other_class(self, cls, name) File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class raise AttributeError(dummy_error_message) AttributeError: 'ModuleMorphismFromMatrix_with_category' object has no attribute 'is_cographic'. Did you mean: 'is_graphic'?
True
"""
try:
sage: result, certificate = M.is_totally_unimodular(certificate=True)
sage: result, certificate
(True, GraphicNode (3×2))
sage: certificate.graph()

Check failure on line 1191 in src/sage/categories/finite_dimensional_modules_with_basis.py

GitHub Actions / test-new

Failed example:

Failed example:: Got: Digraph on 4 vertices
Graph on 4 vertices
"""
try: