Opened 7 years ago

Closed 6 years ago

#15215 closed task (duplicate)

Non-square matrices should inherit from ModuleElement, not RingElement

Reported by: pbruin Owned by:
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: categories Keywords: inheritance
Cc: robertwb Merged in:
Authors: Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by pbruin)

Matrices inherit from RingElement even if they are not square. Their parents do behave correctly.

sage: A = Matrix([[1, 2], [3, 4]])
sage: A.parent() in Rings()
True
sage: A.parent() in Modules(ZZ)
True
sage: isinstance(A, RingElement)
True

sage: B = Matrix([[1, 2, 3], [4, 5, 6]])
sage: B.parent() in Rings()
False
sage: A.parent() in Modules(ZZ)
True
sage: isinstance(B, RingElement)
True

The same happens with Algebras(ZZ) and AlgebraElement.

Square matrices over a ring R should be made to inherit dynamically from AlgebraElement; non-square matrices should only inherit from ModuleElement.

Motivation: Multiplication of matrices over a commutative ring R is in general only a bilinear map between R-modules (in general three different ones). Only if the matrices are square of the same size n can this be described as the multiplication map on an R-algebra, namely Matn(R).

This is a duplicate of #804.

Change History (4)

comment:1 Changed 7 years ago by pbruin

  • Description modified (diff)
  • Milestone changed from sage-5.13 to sage-duplicate/invalid/wontfix

comment:2 Changed 6 years ago by pbruin

  • Status changed from new to needs_review

I propose to close this as a duplicate of #804.

comment:3 Changed 6 years ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

comment:4 Changed 6 years ago by vbraun

  • Resolution set to duplicate
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.