On Tuesday 17 April 2007 04:30, David Harvey wrote:
> On Apr 16, 2007, at 10:24 PM, Robert Miller wrote:
> > sage: M = Matrix(GF(2), [[1,1,0],[0,0,1]])
> > sage: M.row_space()
> >
> > Vector space of degree 3 and dimension 1 over Finite Field of size 2
> > Basis matrix:
> > [1 1 0]
>
> yeah that's bad.

Agreed. Fix appended. This patch also fixes a bug reported by David Kohel 
yesterday via private communication.

Martin

-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: [EMAIL PROTECTED]


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

# HG changeset patch
# User 'Martin Albrecht <[EMAIL PROTECTED]>'
# Date 1176797050 -7200
# Node ID ff3d72577e800fcacd3b1e04b8a12602eae9bf66
# Parent  16b5f14db2248aaa025d325d9651fb75fca51c9c
fixed bug where rank wasn't computed correctly

diff -r 16b5f14db224 -r ff3d72577e80 sage/libs/m4ri/packedmatrix.c
--- a/sage/libs/m4ri/packedmatrix.c	Tue Apr 17 09:19:04 2007 +0200
+++ b/sage/libs/m4ri/packedmatrix.c	Tue Apr 17 10:04:10 2007 +0200
@@ -355,12 +355,12 @@ void rowAddPacked( packedmatrix *m, int 
 
 int gaussianPackedDelayed(packedmatrix *m, int startcol, int full) {
   int i,j;
-  int start, stop=min( m->rows, m->cols);
+  int start; //stop=min( m->rows, m->cols);
 
   int startrow = startcol;
   int ii;
   int pivots = 0;
-  for (i=startcol ; i<stop ; i++) {
+  for (i=startcol ; i<m->cols ; i++) {
 
     for(j=startrow ; j < m->rows; j++) {
       if (readPackedCell(m,j,i)) {
diff -r 16b5f14db224 -r ff3d72577e80 sage/matrix/matrix_mod2_dense.pyx
--- a/sage/matrix/matrix_mod2_dense.pyx	Tue Apr 17 09:19:04 2007 +0200
+++ b/sage/matrix/matrix_mod2_dense.pyx	Tue Apr 17 10:04:10 2007 +0200
@@ -56,6 +56,33 @@ EXAMPLES:
     sage: b.echelonize(); b
     [1 0 1]
     [0 1 0]
+
+TESTS:
+    sage: FF = FiniteField(2)
+    sage: V = VectorSpace(FF,2)
+    sage: v = V([0,1]); v
+    (0, 1)
+    sage: W = V.subspace([v])
+    sage: W
+    Vector space of degree 2 and dimension 1 over Finite Field of size 2
+    Basis matrix:
+    [0 1]
+    sage: v in W
+    True
+
+    sage: M = Matrix(GF(2), [[1,1,0],[0,1,0]])
+    sage: M.row_space()
+    Vector space of degree 3 and dimension 2 over Finite Field of size 2
+    Basis matrix:
+    [1 0 0]
+    [0 1 0]
+
+    sage: M = Matrix(GF(2), [[1,1,0],[0,0,1]])
+    sage: M.row_space()
+    Vector space of degree 3 and dimension 2 over Finite Field of size 2
+    Basis matrix:
+    [1 1 0]
+    [0 0 1]
 
 TODO:
    - make linbox frontend and use it
@@ -627,7 +654,7 @@ cdef class Matrix_mod2_dense(matrix_dens
             _sig_on
             r =  simpleFourRussiansPackedFlex(self._entries, 1, k)
             _sig_off
-
+            
             self.cache('in_echelon_form',True)
             self.cache('rank', r)
             self.cache('pivots', self._pivots())

Reply via email to