Dense Matrices over a general ring

class sage.matrix.matrix_generic_dense.Matrix_generic_dense

Bases: sage.matrix.matrix_dense.Matrix_dense

The Matrix_generic_dense class derives from Matrix, and defines functionality for dense matrices over any base ring. Matrices are represented by a list of elements in the base ring, and element access operations are implemented in this class.

EXAMPLES:

sage: A = random_matrix(Integers(25)['x'], 2)
sage: type(A)
<class 'sage.matrix.matrix_generic_dense.Matrix_generic_dense'>
sage: TestSuite(A).run()

Test comparisons:

sage: A = random_matrix(Integers(25)['x'], 2)
sage: A == A
True
sage: A < A + 1 or A[0, 0].coefficients()[0] == 24
True
sage: A+1 < A and A[0, 0].coefficients()[0] != 24
False

Test hashing:

sage: A = random_matrix(Integers(25)['x'], 2)
sage: hash(A)
Traceback (most recent call last):
...
TypeError: mutable matrices are unhashable
sage: A.set_immutable()
sage: H = hash(A)