Elementary Arithmetic

A + B : Mtrx, Mtrx -> Mtrx
Given m x n matrices A and B over a ring R, return A + B.
A - B : Mtrx, Mtrx -> Mtrx
Given m x n matrices A and B over a ring R, return A - B.
A * B : Mtrx, Mtrx -> Mtrx
Given an m x n matrix A over a ring R and an n x p matrix B over R, return the m x p matrix A.B over R. This function attempts to preserve the maximal amount of information in the choice of parent for the product. For example, if A and B are both square and have the same matrix algebra M as parent, then the product will also have M as parent. Similarly, if the parents of A and B are R-matrix spaces such that the codomain of B equals the domain A, then the product will have domain equal to that of A and codomain equal to that of B.
x * A : RngElt, Mtrx -> Mtrx
A * x : Mtrx, RngElt -> Mtrx
Given an m x n matrix A over a ring R and a ring element x coercible into R, return the scalar product x.A.

Note that if x is not coercible into the ring R then A may be automatically coerced into the ring of x. On the other hand, one particular common case is that multiplying an integral matrix by the real number 1.0 will not coerce the matrix into the reals, as the scalar is coercible into the ring R (the integers) in that case.

- A : Mtrx -> Mtrx
Given a matrix A, return -A.
A ^ -1 : Mtrx, RngIntElt -> Mtrx
Given a invertible square matrix A over a ring R, return the inverse B of A so that A.B = B.A = 1. The coefficient ring R must be either a field, a Euclidean domain, or a ring with an exact division algorithm and having characteristic equal to zero or greater than m (this includes most commutative rings).
A ^ n : Mtrx, RngIntElt -> Mtrx
Given a square matrix A over a ring R and an integer n, return the matrix power An. A0 is defined to be the identity matrix for any square matrix A (even if A is zero). If n is negative, A must be invertible (see the previous function), and the result is (A - 1) - n.
Transpose(A) : Mtrx -> Mtrx
Given an m x n matrix A over a ring R, return the transpose of A, which is simply the n x m matrix over R whose (i, j)-th entry is the (j, i)-th entry of A.
AddScaledMatrix(A, s, B) : Mtrx, RngElt, Mtrx -> Mtrx
Given a matrix A over a ring R, a scalar s coercible into R, and a matrix B over R with the same shape as A, return A + s.B. This is generally quicker than the call A + s*B.
AddScaledMatrix(~A, s, B) : Mtrx, RngElt, Mtrx ->
Given a matrix A over a ring R, a scalar s coercible into R, and a matrix B over R with the same shape as A, set A to A + s.B. This is generally quicker than the statement A := A + s*B;.
V2.28, 13 July 2023