# Ticket #13179(new defect)

Opened 11 months ago

## Compare matrices consistently for different base rings

Reported by: Owned by: SimonKing jason, was major sage-5.10 linear algebra matrix comparison malb N/A

### Description

Apparently we use three essentially different ways of comparing matrices.

```  sage: def test(K):
....:     M1 = Matrix(K,[[1,0,0]])
....:     M2 = Matrix(K,[[0,1,0]])
....:     M3 = Matrix(K,[[0,1,1]])
....:     M4 = Matrix(K,[[0,0,1]])
....:     L = [M1,M2,M3,M4]
....:     L.sort()
....:     return L
....:
```

First group

Matrices over not too big fields of characteristic 2

```  sage: K = GF(2)
sage: test(K)
[[1 0 0], [0 1 0], [0 0 1], [0 1 1]]
sage: K = GF(4,'z')
sage: test(K)
[[1 0 0], [0 1 0], [0 0 1], [0 1 1]]
sage: K = GF(2^10,'q')
sage: test(K)
[[1 0 0], [0 1 0], [0 0 1], [0 1 1]]
```

Second group

Matrices over big finite fields of characteristic 2

```  sage: K = GF(2^100,'q')
sage: test(K)
[[1 0 0], [0 1 0], [0 1 1], [0 0 1]]
```

Third group

Matrices over all other rings

```  sage: K = GF(3)
sage: test(K)
[[0 0 1], [0 1 0], [0 1 1], [1 0 0]]
sage: K = GF(9,'z')
sage: test(K)
[[0 0 1], [0 1 0], [0 1 1], [1 0 0]]
sage: K = GF(3^100,'q')
sage: test(K)
[[0 0 1], [0 1 0], [0 1 1], [1 0 0]]
sage: K = QQ
sage: test(K)
[[0 0 1], [0 1 0], [0 1 1], [1 0 0]]
sage: K = ZZ
sage: test(K)
[[0 0 1], [0 1 0], [0 1 1], [1 0 0]]
sage: K.<x> = GF(2)[]
sage: test(K)
[[0 0 1], [0 1 0], [0 1 1], [1 0 0]]
sage: K.<x> = GF(3)[]
sage: test(K)
[[0 0 1], [0 1 0], [0 1 1], [1 0 0]]
sage: K.<x> = GF(4,'z')[]
sage: test(K)
[[0 0 1], [0 1 0], [0 1 1], [1 0 0]]
sage: K.<x> = GF(2^100,'z')[]
sage: test(K)
[[0 0 1], [0 1 0], [0 1 1], [1 0 0]]
```

I guess the inconsistent behaviour is "big fun" for all who want to implement the F4 algorithm in Sage. It ought to be fixed.

## Change History

### comment:1 Changed 11 months ago by malb

With #13180 fixed this boils down to two groups: M4RI(E) vs the rest.

Note: See TracTickets for help on using tickets.