parent) |
add_multiple_of_column,
add_multiple_of_row,
augment,
block_sum,
change_ring,
columns,
commutator,
copy,
dense_matrix,
dense_row,
dict,
entries,
get,
is_dense,
is_matrix,
is_sparse,
is_square,
iterates,
linear_combination_of_rows,
list,
matrix_space,
ncols,
new_matrix,
nonpivots,
nonzero_positions,
nonzero_positions_in_column,
nonzero_positions_in_row,
nrows,
rescale_row,
row,
rows,
set,
sparse_columns,
sparse_matrix,
sparse_rows,
stack,
submatrix_from_columns,
submatrix_from_rows,
swap_columns,
swap_rows,
trace,
vector_matrix_multiply
Further documentation:
i, j, s) |
Replace column i by s times column j.
i, j, s) |
Replace row i by s times row j.
other) |
Return the augmented matrix of the form [self | other].
other) |
Return the block matrix that has self and other on the diagonal: [self | 0 ] [ 0 | other ]
) |
Returns the list of columns of self, as vectors.
sage: A = MatrixSpace(RationalField(), 2,3) (xrange(6)) sage: A [0 1 2] [3 4 5] sage: A.columns() [(0, 3), (1, 4), (2, 5)]
other) |
Return the commutator self*other - other*self.
) |
Return a copy of this matrix. Changing the entries of the copy will not change the entries of this matrix.
) |
If this matrix is sparse, return a dense matrix with the same entries. If this matrix is dense, return this matrix (not a copy).
NOTE: The definition of "dense" and "sparse" in SAGE have nothing to do with the number of nonzero entries. Sparse and dense are properties of the underlying representation of the matrix.
sage: A = MatrixSpace(RationalField(),2, sparse=True)([1,2,0,1]) sage: A.is_sparse() True sage: B = A.dense_matrix() sage: B.is_sparse() False sage: A*B [1 4] [0 1] sage: A.parent() Full MatrixSpace of 2 by 2 sparse matrices over Rational Field sage: B.parent() Full MatrixSpace of 2 by 2 dense matrices over Rational Field sage: (A*B).parent() Full MatrixSpace of 2 by 2 sparse matrices over Rational Field sage: (B*A).parent() Full MatrixSpace of 2 by 2 dense matrices over Rational Field
) |
This must be defined in the derived class. It is the underlying representation of elements, which may be a list or dict or something else.
ij) |
Entry access, but possibly without bounds checking (for efficiency).
INPUT: A[i, j] -- the i,j of A, and A[i] -- the i-th row of A.
v, n) |
Let
be this matrix and
be a free module element.
Return a vector whose rows are the entries of the following
vectors:
INPUT: v -- free module element n -- nonnegative integer
sage: A = MatrixSpace(IntegerRing(), 2)([1,1,3,5]); A [1 1] [3 5] sage: v = FreeModule(IntegerRing(), 2)([1,0]) sage: A.iterates(v,0) [] sage: A.iterates(v,5) [ 1 0] [ 1 1] [ 4 6] [ 22 34] [124 192]
[nrows=True], [ncols=True], [entries=0], [coerce_entries=None], [copy=None]) |
Create a matrix in the parent of this space with the given number of rows, columns, etc.
WARNING: This function called with no arguments returns the 0 matrix by default, not the matrix self.
) |
Return the list of i such that the i-th column of self is NOT a pivot column of the reduced row echelon form of self.
OUTPUT: list - sorted list of integers
) |
Returns the set of pairs (i,j) such that self[i,j] != 0.
i) |
Return the integers j such that self[j,i] is nonzero, i.e., such that the j-th position of the i-th column is nonzero.
i) |
Return the integers j such that self[i,j] is nonzero, i.e., such that the j-th position of the i-th row is nonzero.
i, s) |
Replace i-th row of self by s times i-th row of self.
) |
If this matrix is dense, return a sparse matrix with the same entries. If this matrix is sparse, return this matrix (not a copy).
NOTE: The definition of "dense" and "sparse" in SAGE have nothing to do with the number of nonzero entries. Sparse and dense are properties of the underlying representation of the matrix.
sage: A = MatrixSpace(RationalField(),2, sparse=False)([1,2,0,1]) sage: A.is_sparse() False sage: B = A.sparse_matrix() sage: B.is_sparse() True sage: A [1 2] [0 1] sage: B [1 2] [0 1] sage: A*B [1 4] [0 1] sage: A.parent() Full MatrixSpace of 2 by 2 dense matrices over Rational Field sage: B.parent() Full MatrixSpace of 2 by 2 sparse matrices over Rational Field sage: (A*B).parent() Full MatrixSpace of 2 by 2 dense matrices over Rational Field sage: (B*A).parent() Full MatrixSpace of 2 by 2 sparse matrices over Rational Field
other) |
Return the augmented matrix self on top of other: [ self ] [ other ]
sage: M = Matrix(RationalField(), 2, 3, range(6)) sage: N = Matrix(RationalField(), 1, 3, [10,11,12]) sage: M.stack(N) [ 0 1 2] [ 3 4 5] [10 11 12]
columns) |
Return the submatrix of self of columns col[i] for i in the list of columns.
rows) |
Return the submatrix of self of rows row[i] for i in the list of rows.
c1, c2) |
Swap columns c1 and c2 of self.
r1, r2) |
Swap rows r1 and r2 of self.
) |
Return the trace of self, which is the sum of the diagonal entries of self.
INPUT: self -- a square matrix OUTPUT: element of the base ring of self
v) |
Returns the vector times matrix product.
INPUT: v -- a free module element. OUTPUT: The the vector times matrix product v*A.
sage: MS = MatrixSpace(RationalField(), 2,2) sage: B = MS.matrix([1,2,1,2]) sage: V = VectorSpace(RationalField(), 2) sage: v = V([1,2]) sage: B.vector_matrix_multiply(v) # computes v*B (3, 6) sage: Bt = B.transpose() sage: Bt.vector_matrix_multiply(v) # computes B*v (5, 5)
Instances of class Matrix also have the following special methods:
__abs__,
__add__,
__cmp__,
__div__,
__getitem__,
__mod__,
__mul__,
__neg__,
__pos__,
__pow__,
__repr__,
__rmul__,
__setitem__,
__str__,
__sub__,
_latex_,
_latex_sparse,
_Matrix__is_compatible,
_pari_,
_right_scalar_multiply,
_scalar_multiply
Further documentation:
ij) |
INPUT: A[i, j] -- the i,j of A, and A[i] -- the i-th row of A.
n) |
sage: MS = MatrixSpace(RationalField(), 3, 3) sage: A = MS([0, 0, 1, 1, 0, '-2/11', 0, 1, '-3/11']) sage: A * A**(-1) == 1 True sage: A**4 [ -3/11 -13/121 1436/1331] [ 127/121 -337/1331 -4445/14641] [ -13/121 1436/1331 -8015/14641]
ij, x) |
INPUT: A[i, j] = value -- set the (i,j) entry of A A[i] = value -- set the ith row of A
[variable=x]) |
Return a latex string that represents this matrix as a sparse matrix. The rows are printed as sums sum a_i x_i, where x is the variable.
See About this document... for information on suggesting changes.