I spent a while running print statements. I'm not sure how this even worked 
previously (was it figuring out the rows and cols based on the "self" 
passed as a parameter?)

There isn't really a sensible default to pass to the sub matrix function, 
in my opinion, because there isn't a sensible default - it is expecting the 
rows/cols of the sub matrix to be a parameter, so  I figured out the 
problem is with the smith_form() function still (mm = t.submatrix(1,1) in 
current version of Sage). I'm not sure how the submatrix() function 
interprets the rows and cols with mod 3/integer coefficients, but if I give 
the other two parameters to the sub matrix() call,

i.e.

inr = t.nrows() - 1
inc = t.ncols() - 1
mm = t.submatrix(1,1,inr,inc)

it appears to fix the issue. From a few examples, I achieved the same 
results as the current master branch (6.11) of Sage.

Examples of my own:

A = Matrix(Integers(3),[[1,0,2],[1,0,1],[1,1,1]])

[1 0 0]  [1 0 0]  [1 0 1]

[0 1 0]  [2 0 1]  [0 1 1]

[0 0 1], [1 2 0], [0 0 1]
(same for mod 3 in current and modified version)

here's an example that I already new the answer to by hand computation (and 
ran this through sage w/ the modified version, this does not work in 
current version of master)

sage: C = 
Matrix(IntegerModRing(2),[[1,0,1,0],[1,1,0,0],[0,1,1,0],[1,0,0,1],[0,0,1,1],[0,1,0,1]])

sage: C.smith_form()

(

[1 0 0 0]  [1 0 0 0 0 0]           

[0 1 0 0]  [1 1 0 0 0 0]           

[0 0 1 0]  [1 0 0 1 0 0]  [1 0 1 1]

[0 0 0 0]  [1 1 1 0 0 0]  [0 1 1 1]

[0 0 0 0]  [1 0 0 1 1 0]  [0 0 1 1]

[0 0 0 0], [0 1 0 1 0 1], [0 0 0 1]

)

sage: t,u,v=C.smith_form()

sage: u.inverse()

[1 0 0 0 0 0]

[1 1 0 0 0 0]

[0 1 0 1 0 0]

[1 0 1 0 0 0]

[0 0 1 0 1 0]

[0 1 1 0 0 1]

I was skimming through 
http://sagemath.github.io/git-developer-guide/walk_through.html and
http://sagemath.github.io/git-developer-guide/trac.html#section-trac-account

should I open a ticket...? or fork sagemath/Sage and make a PR?

On Tuesday, February 18, 2014 2:07:53 PM UTC-5, Martin R. Albrecht wrote:
>
> Looks like a bug to me, i.e. the mod2 submatrix command should assume 
> default parameters when less than four parameters are given. 
>
> I am happy to review your patch ;) 
>
> On 18/02/14 18:38, [email protected] <javascript:> wrote: 
> > I'm trying to compute some homology stuff by finding the smith normal 
> > form of (fairly) large matrices. 
> > 
> > I do the following: 
> > 
> > A = Matrix(IntegerModRing(2),[[1,0,2],[1,0,1]]) A.smith_form() 
> > 
> > and I get the following error: 
> > 
> > TypeError                                 Traceback (most recent call 
> > last) <ipython-input-6-23e95c6be019> in <module>() ----> 1 
> > A.smith_form() 
> > 
> > 
> /Users/.../builds/sage-6.1.1/local/lib/python2.7/site-packages/sage/matrix/matrix2.so
>  
>
> >  in sage.matrix.matrix2.Matrix.smith_form 
> > (sage/matrix/matrix2.c:60007)() 
> > 
> > 
> /Users/.../builds/sage-6.1.1/local/lib/python2.7/site-packages/sage/matrix/matrix_mod2_dense.so
>  
>
> >  in sage.matrix.matrix_mod2_dense.Matrix_mod2_dense.submatrix 
> > (sage/matrix/matrix_mod2_dense.c:10429)() 
> > 
> > TypeError: submatrix() takes exactly 4 positional arguments (2 
> > given) 
> > 
> > Looking at the code, line 12413 (mm = t.submatrix(1,1) ) only passes 
> > two arguments while the actual sub matrix function takes 5 arguments 
> > (itself, which doesn't count, lowr, lowc, nrows, ncols). 
> > 
> > Since the integers mod 2 are a field, this "should" be working in 
> > theory. The integers mod 3 and the integers both work. Any thoughts? 
> > 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to