32.12 Dense Matrices over a general ring

Module: sage.matrix.matrix_generic_dense

Dense Matrices over a general ring

Module-level Functions

Class: Matrix_generic_dense

class Matrix_generic_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.

Functions: matrix_window_c

Special Functions: __copy__,$ \,$ __deepcopy__,$ \,$ __eq__,$ \,$ __ge__,$ \,$ __gt__,$ \,$ __init__,$ \,$ __le__,$ \,$ __lt__,$ \,$ __ne__,$ \,$ _list,$ \,$ _multiply_classical,$ \,$ _pickle,$ \,$ _unpickle

__copy__( )

Creates a copy of self, which may be changed without altering self.

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]

__deepcopy__( )

_list( )

_multiply_classical( )

Multiply the matrices left and right using the classical $ O(n^3)$ algorithm.

We multiply two matrices over a fairly general ring:

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: 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 = 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]

_pickle( )

_unpickle( )

Class: MatrixWindow

class MatrixWindow

Functions: add,$ \,$ add_prod,$ \,$ list,$ \,$ matrix,$ \,$ matrix_window,$ \,$ ncols,$ \,$ new_empty_window,$ \,$ nrows,$ \,$ set_to,$ \,$ set_to_diff,$ \,$ set_to_prod,$ \,$ set_to_sum,$ \,$ set_to_zero,$ \,$ subtract,$ \,$ to_matrix

matrix( )

Returns the underlying matrix that this window is a view of.

matrix_window( )

Returns a matrix window relative to this window of the underlying matrix.

to_matrix( )

Returns an actual matrix object representing this view. (Copy)

Special Functions: __init__,$ \,$ __repr__

__repr__( )

See About this document... for information on suggesting changes.