On Dec 8, 5:11 pm, Nick Alexander <[EMAIL PROTECTED]> wrote:
> David, could I ask for some examples over
> some other rings or doctests explaining why that doesn't work?  I
> think QQ[x] should work, and maybe ZZ / n ZZ (depending on how much
> care you take to make it work).

It works in QQ[x] and there is a doctest, although somehow it ended up
being put in the _smith_onestep docstring rather than the one for
smith_form (because I was trying to nail down a bug which that matrix
exposed). Over ZZ / n ZZ for n composite it isn't expected to work as
the ring isn't a domain, but for n prime it should work. For some
strange reason Integers(p) and GF(p) aren't the same. In the former it
fails, as creating ideals in that ring breaks. Over the latter it does
work, but the answers look a bit strange:

sage: m = matrix(GF(23), 3,3,[15,9,22,11,13,15,7,9,15]); m.smith_form
()
([15  0  0]
[ 0 11  0]
[ 0  0 19],
 [ 1  0  0]
[10  1  0]
[ 2  5  1],
 [ 1  4 14]
[ 0  1 10]
[ 0  0  1])

One would probably want Smith form over fields to give a diagonal
matrix with first some 1's and then some 0's, but it doesn't. This is
because the code doesn't try and pick "canonical generators" of
ideals, since in general there isn't any good way of doing that. But
there is a canonical generator of the unit ideal of any ring, namely
1, and perhaps I should make it pick this generator whenever possible.

--~--~---------~--~----~------------~-------~--~----~
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://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to