IsMatrix( obj ) C
A matrix is a list of lists of equal length whose entries lie in a common ring.
Note that matrices may have different multiplications,
besides the usual matrix product there is for example the Lie product.
So there are categories such as IsOrdinaryMatrix and IsLieMatrix
(see IsOrdinaryMatrix, IsLieMatrix)
that describe the matrix multiplication.
One can form the product of two matrices only if they support the same
multiplication.
gap> mat:=[[1,2,3],[4,5,6],[7,8,9]]; [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] gap> IsMatrix(mat); true
Note also the filter IsTable (see section IsTable)
which may be more appropriate than IsMatrix for some purposes.
Note that the empty list '[ ]' and more complex ``empty'' structures
such as [[ ]] are not matrices, although special
methods allow them be used in place of matrices in some
situations. See EmptyMatrix below.
gap> [[0]]*[[]]; [ [ ] ] gap> IsMatrix([[]]); false
IsOrdinaryMatrix( obj ) C
An ordinary matrix is a matrix whose multiplication is the ordinary matrix multiplication.
Each matrix in internal representation is in the category
IsOrdinaryMatrix,
and arithmetic operations with objects in IsOrdinaryMatrix produce
again matrices in IsOrdinaryMatrix.
Note that we want that Lie matrices shall be matrices that behave in the same way as ordinary matrices, except that they have a different multiplication. So we must distinguish the different matrix multiplications, in order to be able to describe the applicability of multiplication, and also in order to form a matrix of the appropriate type as the sum, difference etc. of two matrices which have the same multiplication.
IsLieMatrix( mat ) C
A Lie matrix is a matrix whose multiplication is given by the
Lie bracket.
(Note that a matrix with ordinary matrix multiplication is in the
category IsOrdinaryMatrix, see IsOrdinaryMatrix.)
Each matrix created by LieObject is in the category IsLieMatrix,
and arithmetic operations with objects in IsLieMatrix produce
again matrices in IsLieMatrix.
GAP 4 manual