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); A
[ x^2 + 12*x + 2 4*x^2 + 13*x + 8]
[ 22*x^2 + 2*x + 17 19*x^2 + 22*x + 14]
sage: type(A)
<type 'sage.matrix.matrix_generic_dense.Matrix_generic_dense'>
sage: A == loads(dumps(A))
True
Creates a copy of self, which may be changed without altering self.
EXAMPLES:
sage: A = matrix(ZZ[['t']], 2,3,range(6)); A
[0 1 2]
[3 4 5]
sage: A.subdivide(1,1); A
[0|1 2]
[-+---]
[3|4 5]
sage: B = A.copy(); B
[0|1 2]
[-+---]
[3|4 5]
sage: B == A
True
sage: B[0,0] = 100
sage: B
[100| 1 2]
[---+-------]
[ 3| 4 5]
sage: A
[0|1 2]
[-+---]
[3|4 5]
Return reference to list of entries of self. For internal use only, since this circumvents immutability.
Multiply the matrices left and right using the classical
algorithm.
sage: R.<x,y> = Integers(8)[‘x,y’] sage: a = matrix(R,2,[x,y,x^2,y^2]); a [ x y] [x^2 y^2] sage: type(a) <type ‘sage.matrix.matrix_generic_dense.Matrix_generic_dense’> sage: a*a [ x^2*y + x^2 y^3 + x*y] [x^2*y^2 + x^3 y^4 + x^2*y] sage: a.det()^2 == (a*a).det() True sage: a._multiply_classical(a) [ x^2*y + x^2 y^3 + x*y] [x^2*y^2 + x^3 y^4 + x^2*y]
sage: A = matrix(QQ[‘x,y’], 2, [0,-1,2,-2]) sage: B = matrix(QQ[‘x,y’], 2, [-1,-1,-2,-2]) sage: A*B [2 2] [2 2]
Sage fully supports degenerate matrices with 0 rows or 0 columns:
sage: A = matrix(QQ['x,y'], 0, 4, []); A
[]
sage: B = matrix(QQ['x,y'], 4,0, []); B
[]
sage: A*B
[]
sage: B*A
[0 0 0 0]
[0 0 0 0]
[0 0 0 0]
[0 0 0 0]
Create list of entries that define a matrix from a list of vectors.