diff --git a/src/sage/matrix/matrix_cmr_sparse.pyx b/src/sage/matrix/matrix_cmr_sparse.pyx index 7a52e6013a6..4e9f13324af 100644 --- a/src/sage/matrix/matrix_cmr_sparse.pyx +++ b/src/sage/matrix/matrix_cmr_sparse.pyx @@ -465,10 +465,31 @@ cdef class Matrix_cmr_chr_sparse(Matrix_cmr_sparse): def three_sum(first_mat, second_mat, first_col_index1, first_col_index2, second_col_index1, second_col_index2): r""" - Return the 3-sum matrix constructed from the given matrices ``first_mat`` and ``second_mat``, with 'first_col_index1' - and 'first_col_index2' being the indices of the column vectors of the matrix, which are identical except for one row - having a 0 in one column and the other a non-zero entry in that row. The method assumes the nonzero entry is one. The same assumptions - are made for 'second_mat' and its input index variables. + Return the 3-sum matrix constructed from the given matrices ``first_mat`` and ``second_mat``, with ``first_col_index1`` + and ``first_col_index2`` being the indices of the column vectors of the matrix, which are identical except for one row + having a 0 in one column and the other a non-zero entry in that row. The method assumes the nonzero entry is one. The same goes + are made for ``second_mat``, ``second_col_index1``, and ``second_col_index2``. + + The operation performed is effectively as in Schrijver:= + [first_submat first_subcol first_subcol] ___|___ [second_submat second_subcol second_suncol] + [ first_row 0 1 ] | 3 [ second_row 0 1 ] + ----- [ first_submat first_subcol x second_row] + ----- [second_subcol x first_row second_subcol ] + + INPUT: + + - ``first_mat`` -- integer matrix having two collumns which are identical in every entry except for one row in + which one is 0 and the other is 1 + - ``second_mat`` -- integer matrix having two collumns which are identical in every entry except for one row in + which one is 0 and the other is 1 + - ``first_col_index1`` -- index of a column in ``first_mat`` identical to some other column in every entry except for one row in + which one is 0 and the other is 1 + - ``first_col_index2`` -- index of the other column which is identical to first_mat[first_col_index1] in every entry except for one + row in which one is 0 and the other is 1 + - ``second_col_index1`` -- index of a column in ``second_mat`` identical to some other column in every entry except for one row in + which one is 0 and the other is 1 + - ``first_col_index2`` -- index of the other column which is identical to second_mat[second_col_index1] in every entry except for one + row in which one is 0 and the other is 1 EXAMPLES:: diff --git a/src/sage/matrix/seymour_decomposition.pyx b/src/sage/matrix/seymour_decomposition.pyx index 44ae44d2b30..a727e000857 100644 --- a/src/sage/matrix/seymour_decomposition.pyx +++ b/src/sage/matrix/seymour_decomposition.pyx @@ -440,7 +440,31 @@ cdef class PlanarNode(BaseGraphicNode): cdef class SeriesParallelReductionNode(DecompositionNode): - pass + def core(self): + r""" + EXAMPLES:: + + sage: from sage.matrix.matrix_cmr_sparse import Matrix_cmr_chr_sparse + sage: M = Matrix_cmr_chr_sparse(MatrixSpace(ZZ, 5, 6, sparse=True), + ....: [[1, 1, 1, 1, 1, 0], [1, 1, 1, 0,0, 0], + ....: [1, 0, 1, 1, 0, 1] ,[1, 0,0, 1, 1, 0], + ....: [1, 1, 0, 0, 1, 0]]); M + [1 1 1 1 1 0] + [1 1 1 0 0 0] + [1 0 1 1 0 1] + [1 0 0 1 1 0] + [1 1 0 0 1 0] + sage: result, certificate = M.is_totally_unimodular(certificate = True); result + ....: , certificate + (True, SeriesParallelReductionNode (5×6)) + sage: certificate.core() + [1 1 1 1 1] + [1 1 1 0 0] + [1 0 1 1 0] + [1 0 0 1 1] + [1 1 0 0 1] + """ + return self._children()[0].matrix() cdef class SpecialLeafNode(DecompositionNode): @@ -475,8 +499,17 @@ cdef class SpecialLeafNode(DecompositionNode): assert False, 'special leaf node with unknown type' def _repr_(self): - return f'Minor isomorphic to {self._matroid()}' + return f'Isomorphic to a minor of {self._matroid()}' + + def rep_matrix(self): + r""" + WIP + """ + assert NotImplementedError + cdef int representation_matrix + cdef CMR_DEC_TYPE typ = CMRdecIsSpecialLeaf(self._dec, &representation_matrix) + return Matrix_cmr_chr_sparse._from_data(representation_matrix, immutable=False) cdef _class(CMR_DEC *dec): k = CMRdecIsSum(dec, NULL, NULL)