On Feb 4, 1:03 am, daveloeffler <[email protected]> wrote:
> > 2. The Linbox implementation and the Pari implementation differ by a
> > transpose; that is, if you really want the two to agree on some matrix
> > m, you need to compare
>
> Ah, I think you've just uncovered an inconsistency.
I think I just found another one, related to your code: if m is
sparse, then
m.elementary_divisors()
and
m.dense_matrix().elementary_divisors()
can return lists of different lengths, because of different choices in
the Pari implementation vs. your choice. Here's a trac ticket about
this: <http://trac.sagemath.org/sage_trac/ticket/5183>.
> By definition, the elementary divisors of m.transpose() are equal by
> definition to the elementary divisors of m, if m is square. But if m
> isn't square, the different routines in Sage use different
> conventions. The Pari implementation seems to pad with zeroes to
> return a list as long as the number of columns of M. From what you say
> it sounds like the Linbox one pads to the number of rows of M.
> Meanwhile, the slow generic implementation that I wrote for matrices
> over general PID's returns a list of length min(nrows, ncols).
>
> I don't have a strong opinion on which answer is the right one, but it
> certainly shouldn't be inconsistent like this.
It's easy enough to fix in the elementary_divisors function: just take
the transpose (if that's the agreed-upon solution) before calling the
linbox version, or don't take the transpose before calling the pari
version. Then make sure that mat._elementary_divisors_linbox(), or
whatever it's called, is documented to make clear the difference in
conventions.
> Personally I'd prefer
> it if M.elementary_divisors() was always equal to M.transpose
> ().elementary_divisors(), which is the convention I used.
I don't think it matters too much to me, as long as it is very clearly
documented.
> David
John
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---