Ticket #2412 (closed defect: invalid)

Opened 5 years ago

Last modified 5 years ago

basis_matrix returns matrix over wrong ring

Reported by: ncalexan Owned by: was
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: linear algebra Keywords: basis matrix basis_matrix ZZ
Cc: ncalexan, jason Work issues:
Report Upstream: Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

sage: (ZZ**3).basis_matrix()

[1 0 0]
[0 1 0]
[0 0 1]
sage: (ZZ**3).basis_matrix().parent()
Full MatrixSpace of 3 by 3 dense matrices over Rational Field

That should be over the integer ring; you can't do (ZZ**3).basis_matrix().smith_form() otherwise.

Change History

comment:1 Changed 5 years ago by was

This is not a bug, it is a design decision. ZZ modules in Sage in general need *not* be embedded in ZZn -- they can be in QQn. For consistency the basis matrix is thus always over QQ. Here's an example of a module over ZZ but for which the basis matrix is over QQ.

sage: A = (ZZ^3).span([[1,2,3], [1/3,5,6]])
sage: A
Free module of degree 3 and rank 2 over Integer Ring
Echelon basis matrix:
[1/3   5   6]
[  0  13  15]
sage: A.basis_matrix()
[1/3   5   6]
[  0  13  15]

I'm willing to consider changing the design to *try* to make the basis matrix over ZZ if posible, otherwise make it over QQ. Thoughts? I doubt this will break anything.... (famous last words).

comment:2 Changed 5 years ago by jason

  • Cc jason added

comment:3 Changed 5 years ago by jason

  • Status changed from new to closed
  • Resolution set to invalid

As per request on IRC:

[23:17] <ncalexan> jason--: I think that decision is fine.  I say close it as invalid.

comment:4 Changed 5 years ago by mabshoff

  • Milestone changed from sage-3.2.1 to sage-duplicate/invalid/wontfix
Note: See TracTickets for help on using tickets.