@@ -544,36 +544,61 @@ cdef class ThreeSumNode(SumNode):
544
544
545
545
def is_distributed_ranks (self ):
546
546
r """
547
- EXAMPLES::
548
-
549
- sage: from sage. matrix. matrix_cmr_sparse import Matrix_cmr_chr_sparse
550
- sage: R12 = Matrix_cmr_chr_sparse( MatrixSpace( ZZ, 9, 12, sparse=True) ,
551
- .... : [[1, -1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1 ],
552
- .... : [0, 0, 0, 1, -1, 0, 0, 0, 1 , 1, 1, 1 ],
553
- .... : [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 ],
554
- .... : [ 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0 ],
555
- .... : [ 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, -1, -1 ],
556
- .... : [ 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0 ],
557
- .... : [ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, -1, -1 ],
558
- .... : [ 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0 ],
559
- .... : [ 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1 ]])
560
- sage: result, certificate = R12 . is_totally_unimodular( certificate=True)
561
- sage: C = certificate. _children( ) [0 ]; C
562
- ThreeSumNode ( 9×12) with 2 children
563
- sage: C. is_distributed_ranks( )
564
- True
565
- sage: C. is_concentrated_rank( )
566
- False
547
+ EXAMPLES::
548
+
549
+ sage: from sage. matrix. matrix_cmr_sparse import Matrix_cmr_chr_sparse
550
+ sage: R12_large = Matrix_cmr_chr_sparse( MatrixSpace( ZZ, 9, 12, sparse=True) ,
551
+ .... : [[1, -1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1 ],
552
+ .... : [0, 0, 0, 1, -1, 0, 0, 0, 1 , 1, 1, 1 ],
553
+ .... : [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 ],
554
+ .... : [ 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0 ],
555
+ .... : [ 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, -1, -1 ],
556
+ .... : [ 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0 ],
557
+ .... : [ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, -1, -1 ],
558
+ .... : [ 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0 ],
559
+ .... : [ 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1 ]])
560
+ sage: result, certificate = R12_large . is_totally_unimodular( certificate=True)
561
+ sage: C = certificate. _children( ) [0 ]; C
562
+ ThreeSumNode ( 9×12) with 2 children
563
+ sage: C. is_distributed_ranks( )
564
+ True
565
+ sage: C. is_concentrated_rank( )
566
+ False
567
567
"""
568
568
return < bint> CMRmatroiddecThreeSumDistributedRanks(self ._dec)
569
569
570
570
def is_concentrated_rank (self ):
571
571
return < bint> CMRmatroiddecThreeSumConcentratedRank(self ._dec)
572
572
573
573
def block_matrix_form (self ):
574
+ r """
575
+ EXAMPLES::
576
+
577
+ sage: from sage. matrix. matrix_cmr_sparse import Matrix_cmr_chr_sparse
578
+ sage: R12 = Matrix_cmr_chr_sparse( MatrixSpace( ZZ, 6, 6, sparse=True) ,
579
+ .... : [[1,0,1,1,0,0 ],[0,1,1,1,0,0 ],[1,0,1,0,1,1 ],
580
+ .... : [0,-1,0,-1,1,1 ],[1,0,1,0,1,0 ],[0,-1,0,-1,0,1 ]])
581
+ sage: R12
582
+ [ 1 0 1 1 0 0 ]
583
+ [ 0 1 1 1 0 0 ]
584
+ [ 1 0 1 0 1 1 ]
585
+ [ 0 -1 0 -1 1 1 ]
586
+ [ 1 0 1 0 1 0 ]
587
+ [ 0 -1 0 -1 0 1 ]
588
+ sage: result, certificate = R12. is_totally_unimodular( certificate=True)
589
+ sage: C = certificate. _children( ) [0 ]; C
590
+ ThreeSumNode ( 6×6) with 2 children
591
+ sage: C. block_matrix_form( )
592
+ [ 0 0 1 -1 1 0 ]
593
+ [ 1 1 1 0 0 0 ]
594
+ [ 0 1 0 1 -1 0 ]
595
+ [ 0 0 0 1 0 1 ]
596
+ [ 1 0 1 0 1 1 ]
597
+ [ 1 0 1 0 0 1 ]
598
+ """
574
599
M1, M2 = self .summand_matrices()
575
- x, y = len ( M1.columns()), len (M2.columns() )
576
- return Matrix_cmr_chr_sparse.two_sum (M1, M2, x - 1 , x- 2 , y - 1 , y - 2 )
600
+ x = M1.ncols( )
601
+ return Matrix_cmr_chr_sparse.three_sum (M1, M2, x - 2 , x - 1 , 0 , 1 )
577
602
578
603
579
604
cdef class BaseGraphicNode(DecompositionNode):
0 commit comments