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.


sage: A = random_matrix(Integers(25)['x'],2); A
[       0  8*x + 1]
[17*x + 4        0]
sage: type(A)
<type '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
sage: A < A + 1
sage: A+1 < A

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)