Ticket #12361: trac_12361_index_in_saturation_fix.patch

File trac_12361_index_in_saturation_fix.patch, 1.5 KB (added by vbraun, 11 years ago)

Initial patch

• sage/matrix/matrix_integer_dense_saturation.py

```# HG changeset patch
# User Volker Braun <vbraun@stp.dias.ie>
# Date 1327550349 28800
# Node ID 3e6b2ece46d859480525acb64790a25c3bd4da4a
# Parent  32369a57f69dbd70cace5368c949e9420ee97f94
Trac #12361: Fix index_in_saturation for zero-sized matrices

diff --git a/sage/matrix/matrix_integer_dense_saturation.py b/sage/matrix/matrix_integer_dense_saturation.py```
 a return C.change_ring(ZZ)._insert_zero_columns(zero_cols) def index_in_saturation(A, proof=True): """ r""" The index of A in its saturation. INPUT: A -- matrix over ZZ proof -- bool (True or False) INPUT:: - ``A`` -- matrix over `\ZZ` - ``proof`` -- boolean (``True`` or ``False``) OUTPUT: an integer EXAMPLES: An integer EXAMPLES:: sage: from sage.matrix.matrix_integer_dense_saturation import index_in_saturation sage: A = matrix(ZZ, 2, 2, [3,2,3,4]); B = matrix(ZZ, 2,3,[1,2,3,4,5,6]); C = A*B; C [11 16 21] sage: S = W.saturation() sage: W.index_in(S) 18 TESTS:: sage: zero = matrix(ZZ, [[]]) sage: zero.index_in_saturation() 1 """ r = A.rank() if r==0 and (A.nrows()==0 or A.ncols()==0): return 1 if r < A.nrows(): A = A.hermite_form(proof=proof, include_zero_rows=False) if A.is_square():