Are there two different ordering issues here: (1) do zeroes go at the
beginning or at the end?  (2) Does each nonzero entry divide the next,
or the previous?

For (2) I think the usual is to have each divide the next (so for
example any 1's are at the front), though pari does the opposite;  for
(1) I'm not sure that there is a universal convention, but logic would
suggest that we follow what is done for (2) which means 0's at the end
(provided we go for the non-pari convention for (2)).

I agree that this needs sorting, but if you change smith_form() then I
hope you will do a search_src("smith_form") and deal with what comes
up!  (Answer: apparently very little outside of doctests, and one of
those is your own eta product application.  But I have used it in a
patch which has been merged in 3.2.2 also!)

John

2008/12/8 daveloeffler <[EMAIL PROTECTED]>:
>
> At the moment, if I create an integer matrix, there are methods
> "elementary_divisors" and "smith_form". Example:
>
> sage: m = matrix(ZZ,3,3,xrange(9)); m.elementary_divisors()
> [1, 3, 0]
> sage: m.smith_form()
> ([0 0 0]
> [0 3 0]
> [0 0 1],
>  [-1  2 -1]
> [ 0 -1  1]
> [ 0  1  0],
>  [ 1  4 -1]
> [-2 -3  1]
> [ 1  0  0])
>
> According to the docstring for smith_form, the method "returns
> matrices S, U, and V such that S = U*self*V, and S is in Smith normal
> form.  Thus S is diagonal with diagonal entries the ordered elementary
> divisors of S. WARNING: The elementary_divisors function, which
> returns the diagonal entries of S, is VASTLY faster than this
> function."
>
> But as you can see from the example above, the diagonal entries of S
> are ordered differently from the elementary divisors. So there's an
> inconsistency there. Sage takes its conventions for the
> elementary_divisors function from linbox, although at present
> calculation via linbox is disabled, and the code is actually taking
> Pari's output and reversing the order.
>
> I suggest we should change one or the other to make it consistent.
> Does anyone have any strong preferences for which? I suggest that we
> keep elementary_divisors as it is and change smith_form. This breaks
> consistency with Pari, but makes us consistent with every other Smith
> form implementation I've seen (including those in Gap, Kash, Magma and
> Maple). Also, changing smith_form rather than elementary_divisors
> would probably have fewer knock-on effects for existing Sage code.
>
> This came up during the review process for patch #4681, which adds
> Smith form over more general base rings. I'm quite keen to get this
> patch in, and the reviewer raised this consistency issue, so if nobody
> objects violently in the next day or two I'll change the existing
> Smith form over ZZ.
>
> Regards,
>
> David
> >
>

--~--~---------~--~----~------------~-------~--~----~
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