Opened 5 years ago

Closed 5 years ago

#24865 closed defect (fixed)

Finite field elements should not have a _matrix_ method

Reported by: Jeroen Demeyer Owned by:
Priority: major Milestone: sage-8.2
Component: linear algebra Keywords:
Cc: Merged in:
Authors: Jeroen Demeyer Reviewers: Frédéric Chapoton
Report Upstream: N/A Work issues:
Branch: bde1b85 (Commits, GitHub, GitLab) Commit: bde1b855b33d08186c2ae4d7d1f81728370c21c3
Dependencies: Stopgaps:

Status badges

Description (last modified by Jeroen Demeyer)

This is unexpected:

sage: k.<a> = GF(4)
sage: matrix(a, nrows=2, ncols=2)
[0 1]
[1 1]

because one would typically expect a scalar matrix instead:

sage: R.<a> = EisensteinIntegers()
sage: matrix(a, nrows=2, ncols=2)
[a 0]
[0 a]

This is because finite field elements implement _matrix_ and this takes priority in the matrix constructor.

Proposal: rename _matrix_ to matrix to make it usable as ordinary method.

Change History (9)

comment:1 Changed 5 years ago by Jeroen Demeyer

Branch: u/jdemeyer/finite_field_elements_should_not_have_a__matrix__method

comment:2 Changed 5 years ago by Jeroen Demeyer

Commit: a4ad0559b125cec96e28722046e8bd57d9771ef4
Status: newneeds_review

New commits:

a4ad055Finite field elements should not have a _matrix_ method

comment:3 Changed 5 years ago by Jeroen Demeyer

Description: modified (diff)

comment:4 Changed 5 years ago by Frédéric Chapoton

Reviewers: Frédéric Chapoton

the doc of the matrix method may need to start by r"""

comment:5 in reply to:  4 Changed 5 years ago by Jeroen Demeyer

Replying to chapoton:

the doc of the matrix method may need to start by r"""

Is there are particular reason? The patchbot is green...

comment:6 Changed 5 years ago by Frédéric Chapoton

Status: needs_reviewpositive_review

I have seen a \dots in the doc. But ok, let it be..

comment:7 Changed 5 years ago by git

Commit: a4ad0559b125cec96e28722046e8bd57d9771ef4bde1b855b33d08186c2ae4d7d1f81728370c21c3
Status: positive_reviewneeds_review

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. This was a forced push. New commits:

bde1b85Finite field elements should not have a _matrix_ method

comment:8 Changed 5 years ago by Jeroen Demeyer

Status: needs_reviewpositive_review

I changed it anyway. I guess it doesn't hurt.

comment:9 Changed 5 years ago by Volker Braun

Branch: u/jdemeyer/finite_field_elements_should_not_have_a__matrix__methodbde1b855b33d08186c2ae4d7d1f81728370c21c3
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.