Skip to content

Commit f4746a4

Browse files
committed
add PivotsNode example
1 parent 2fc5f2f commit f4746a4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/sage/matrix/seymour_decomposition.pyx

+16
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,22 @@ cdef class PivotsNode(DecompositionNode):
593593
@cached_method
594594
def pivot_rows_and_columns(self):
595595
r"""
596+
sage: from sage.matrix.matrix_cmr_sparse import Matrix_cmr_chr_sparse
597+
sage: R12 = Matrix_cmr_chr_sparse(MatrixSpace(ZZ, 9, 12, sparse=True),
598+
....: [[1, -1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1],
599+
....: [0, 0, 0, 1, -1, 0, 0, 0, 1 , 1, 1, 1],
600+
....: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1],
601+
....: [ 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0],
602+
....: [ 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, -1, -1],
603+
....: [ 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0],
604+
....: [ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, -1, -1],
605+
....: [ 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0],
606+
....: [ 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1]])
607+
sage: result, certificate = R12.is_totally_unimodular(certificate=True)
608+
sage: certificate
609+
PivotsNode (9×12)
610+
sage: certificate.pivot_rows_and_columns()
611+
((1, 8),)
596612
"""
597613
cdef size_t *pivot_rows = CMRmatroiddecPivotRows(self._dec)
598614
cdef size_t *pivot_columns = CMRmatroiddecPivotColumns(self._dec)

0 commit comments

Comments
 (0)