# SquareMatrixCategory(ndim, R, Row, Col)¶

- ndim: NonNegativeInteger
- R: Join(SemiRng, AbelianMonoid)
- Row: DirectProductCategory(ndim, R)
- Col: DirectProductCategory(ndim, R)

SquareMatrixCategory is a general square matrix category which allows different representations and indexing schemes. Rows and columns may be extracted with rows returned as objects of type Row and colums returned as objects of type Col.

- 0: %
- from AbelianMonoid
- 1: % if R has SemiRing
- from MagmaWithUnit
- #: % -> NonNegativeInteger
- from Aggregate
- *: (%, %) -> %
- from Magma

- *: (%, Col) -> Col
`x * c`

is the product of the matrix`x`

and the column vector`c`

. Error: if the dimensions are incompatible.- *: (%, R) -> %
- from RightModule R
- *: (Integer, %) -> % if R has AbelianGroup or % has AbelianGroup
- from AbelianGroup
- *: (NonNegativeInteger, %) -> %
- from AbelianMonoid
- *: (PositiveInteger, %) -> %
- from AbelianSemiGroup
- *: (R, %) -> %
- from LeftModule R

- *: (Row, %) -> Row
`r * x`

is the product of the row vector`r`

and the matrix`x`

. Error: if the dimensions are incompatible.- +: (%, %) -> %
- from AbelianSemiGroup
- -: % -> % if R has AbelianGroup or % has AbelianGroup
- from AbelianGroup
- -: (%, %) -> % if R has AbelianGroup or % has AbelianGroup
- from AbelianGroup
- /: (%, R) -> % if R has Field
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- =: (%, %) -> Boolean
- from BasicType

- ^: (%, Integer) -> % if R has Field
`m^n`

computes an integral power of the matrix`m`

. Error: if the matrix is not invertible.- ^: (%, NonNegativeInteger) -> % if R has SemiRing
- from MagmaWithUnit
- ^: (%, PositiveInteger) -> %
- from Magma
- ~=: (%, %) -> Boolean
- from BasicType
- annihilate?: (%, %) -> Boolean if R has Ring
- from Rng
- antiCommutator: (%, %) -> %
- from NonAssociativeSemiRng
- antisymmetric?: % -> Boolean
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- any?: (R -> Boolean, %) -> Boolean
- from HomogeneousAggregate R
- associator: (%, %, %) -> % if R has Ring
- from NonAssociativeRng
- characteristic: () -> NonNegativeInteger if R has Ring
- from NonAssociativeRing
- coerce: % -> OutputForm
- from CoercibleTo OutputForm
- coerce: Fraction Integer -> % if R has RetractableTo Fraction Integer
- from RetractableTo Fraction Integer
- coerce: Integer -> % if R has RetractableTo Integer or R has Ring
- from NonAssociativeRing
- coerce: R -> %
- from Algebra R
- column: (%, Integer) -> Col
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- columnSpace: % -> List Col if R has EuclideanDomain
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- commutator: (%, %) -> % if R has Ring
- from NonAssociativeRng
- convert: % -> InputForm if R has Finite
- from ConvertibleTo InputForm
- copy: % -> %
- from Aggregate
- count: (R -> Boolean, %) -> NonNegativeInteger
- from HomogeneousAggregate R
- count: (R, %) -> NonNegativeInteger
- from HomogeneousAggregate R
- D: % -> % if R has Ring and R has DifferentialRing
- from DifferentialRing
- D: (%, List Symbol) -> % if R has Ring and R has PartialDifferentialRing Symbol
- from PartialDifferentialRing Symbol
- D: (%, List Symbol, List NonNegativeInteger) -> % if R has Ring and R has PartialDifferentialRing Symbol
- from PartialDifferentialRing Symbol
- D: (%, NonNegativeInteger) -> % if R has Ring and R has DifferentialRing
- from DifferentialRing
- D: (%, R -> R) -> % if R has Ring
- from DifferentialExtension R
- D: (%, R -> R, NonNegativeInteger) -> % if R has Ring
- from DifferentialExtension R
- D: (%, Symbol) -> % if R has Ring and R has PartialDifferentialRing Symbol
- from PartialDifferentialRing Symbol
- D: (%, Symbol, NonNegativeInteger) -> % if R has Ring and R has PartialDifferentialRing Symbol
- from PartialDifferentialRing Symbol

- determinant: % -> R if R has CommutativeRing
`determinant(m)`

returns the determinant of the matrix`m`

.

- diagonal: % -> Row
`diagonal(m)`

returns a row consisting of the elements on the diagonal of the matrix`m`

.- diagonal?: % -> Boolean
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)

- diagonalMatrix: List R -> %
`diagonalMatrix(l)`

returns a diagonal matrix with the elements of`l`

on the diagonal.

- diagonalProduct: % -> R
`diagonalProduct(m)`

returns the product of the elements on the diagonal of the matrix`m`

.- differentiate: % -> % if R has Ring and R has DifferentialRing
- from DifferentialRing
- differentiate: (%, List Symbol) -> % if R has Ring and R has PartialDifferentialRing Symbol
- from PartialDifferentialRing Symbol
- differentiate: (%, List Symbol, List NonNegativeInteger) -> % if R has Ring and R has PartialDifferentialRing Symbol
- from PartialDifferentialRing Symbol
- differentiate: (%, NonNegativeInteger) -> % if R has Ring and R has DifferentialRing
- from DifferentialRing
- differentiate: (%, R -> R) -> % if R has Ring
- from DifferentialExtension R
- differentiate: (%, R -> R, NonNegativeInteger) -> % if R has Ring
- from DifferentialExtension R
- differentiate: (%, Symbol) -> % if R has Ring and R has PartialDifferentialRing Symbol
- from PartialDifferentialRing Symbol
- differentiate: (%, Symbol, NonNegativeInteger) -> % if R has Ring and R has PartialDifferentialRing Symbol
- from PartialDifferentialRing Symbol
- elt: (%, Integer, Integer) -> R
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- elt: (%, Integer, Integer, R) -> R
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- empty: () -> %
- from Aggregate
- empty?: % -> Boolean
- from Aggregate
- enumerate: () -> List % if R has Finite
- from Finite
- eq?: (%, %) -> Boolean
- from Aggregate
- eval: (%, Equation R) -> % if R has Evalable R
- from Evalable R
- eval: (%, List Equation R) -> % if R has Evalable R
- from Evalable R
- eval: (%, List R, List R) -> % if R has Evalable R
- from InnerEvalable(R, R)
- eval: (%, R, R) -> % if R has Evalable R
- from InnerEvalable(R, R)
- every?: (R -> Boolean, %) -> Boolean
- from HomogeneousAggregate R
- exquo: (%, R) -> Union(%, failed) if R has IntegralDomain
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- hash: % -> SingleInteger
- from SetCategory
- hashUpdate!: (HashState, %) -> HashState
- from SetCategory
- index: PositiveInteger -> % if R has Finite
- from Finite

- inverse: % -> Union(%, failed) if R has Field
`inverse(m)`

returns the inverse of the matrix`m`

, if that matrix is invertible and returns “failed” otherwise.- latex: % -> String
- from SetCategory
- leftPower: (%, NonNegativeInteger) -> % if R has SemiRing
- from MagmaWithUnit
- leftPower: (%, PositiveInteger) -> %
- from Magma
- leftRecip: % -> Union(%, failed) if R has SemiRing
- from MagmaWithUnit
- less?: (%, NonNegativeInteger) -> Boolean
- from Aggregate
- listOfLists: % -> List List R
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- lookup: % -> PositiveInteger if R has Finite
- from Finite
- map!: (R -> R, %) -> % if % has shallowlyMutable
- from HomogeneousAggregate R
- map: ((R, R) -> R, %, %) -> %
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- map: (R -> R, %) -> %
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- matrix: List List R -> %
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- maxColIndex: % -> Integer
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- maxRowIndex: % -> Integer
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- member?: (R, %) -> Boolean
- from HomogeneousAggregate R
- members: % -> List R
- from HomogeneousAggregate R
- minColIndex: % -> Integer
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)

- minordet: % -> R if R has CommutativeRing
`minordet(m)`

computes the determinant of the matrix`m`

using minors.- minRowIndex: % -> Integer
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- more?: (%, NonNegativeInteger) -> Boolean
- from Aggregate
- ncols: % -> NonNegativeInteger
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- nrows: % -> NonNegativeInteger
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- nullity: % -> NonNegativeInteger if R has IntegralDomain
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- nullSpace: % -> List Col if R has IntegralDomain
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- one?: % -> Boolean if R has SemiRing
- from MagmaWithUnit
- opposite?: (%, %) -> Boolean
- from AbelianMonoid
- parts: % -> List R
- from HomogeneousAggregate R

- Pfaffian: % -> R if R has CommutativeRing
`Pfaffian(m)`

returns the Pfaffian of the matrix`m`

. Error: if the matrix is not antisymmetric.- qelt: (%, Integer, Integer) -> R
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- random: () -> % if R has Finite
- from Finite
- rank: % -> NonNegativeInteger if R has IntegralDomain
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- recip: % -> Union(%, failed) if R has SemiRing
- from MagmaWithUnit
- reducedSystem: (Matrix %, Vector %) -> Record(mat: Matrix Integer, vec: Vector Integer) if R has Ring and R has LinearlyExplicitOver Integer
- from LinearlyExplicitOver Integer
- reducedSystem: (Matrix %, Vector %) -> Record(mat: Matrix R, vec: Vector R) if R has Ring
- from LinearlyExplicitOver R
- reducedSystem: Matrix % -> Matrix Integer if R has Ring and R has LinearlyExplicitOver Integer
- from LinearlyExplicitOver Integer
- reducedSystem: Matrix % -> Matrix R if R has Ring
- from LinearlyExplicitOver R
- retract: % -> Fraction Integer if R has RetractableTo Fraction Integer
- from RetractableTo Fraction Integer
- retract: % -> Integer if R has RetractableTo Integer
- from RetractableTo Integer
- retract: % -> R
- from RetractableTo R
- retractIfCan: % -> Union(Fraction Integer, failed) if R has RetractableTo Fraction Integer
- from RetractableTo Fraction Integer
- retractIfCan: % -> Union(Integer, failed) if R has RetractableTo Integer
- from RetractableTo Integer
- retractIfCan: % -> Union(R, failed)
- from RetractableTo R
- rightPower: (%, NonNegativeInteger) -> % if R has SemiRing
- from MagmaWithUnit
- rightPower: (%, PositiveInteger) -> %
- from Magma
- rightRecip: % -> Union(%, failed) if R has SemiRing
- from MagmaWithUnit
- row: (%, Integer) -> Row
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- rowEchelon: % -> % if R has EuclideanDomain
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- sample: %
- from AbelianMonoid

- scalarMatrix: R -> %
`scalarMatrix(r)`

returns an`n`

-by-`n`

matrix with`r`

`'s`

on the diagonal and zeroes elsewhere.- size: () -> NonNegativeInteger if R has Finite
- from Finite
- size?: (%, NonNegativeInteger) -> Boolean
- from Aggregate
- smaller?: (%, %) -> Boolean if R has Finite
- from Comparable
- square?: % -> Boolean
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)
- subtractIfCan: (%, %) -> Union(%, failed) if R has AbelianGroup or % has AbelianGroup
- from CancellationAbelianMonoid
- symmetric?: % -> Boolean
- from RectangularMatrixCategory(ndim, ndim, R, Row, Col)

- trace: % -> R
`trace(m)`

returns the trace of the matrix`m`

. this is the sum of the elements on the diagonal of the matrix`m`

.- zero?: % -> Boolean
- from AbelianMonoid

AbelianGroup if R has AbelianGroup

Algebra R if R has CommutativeRing

BiModule(%, %)

BiModule(R, R)

CancellationAbelianMonoid if R has AbelianGroup or % has AbelianGroup

Comparable if R has Finite

ConvertibleTo InputForm if R has Finite

DifferentialExtension R if R has Ring

DifferentialRing if R has Ring and R has DifferentialRing

Evalable R if R has Evalable R

FullyLinearlyExplicitOver R if R has Ring

InnerEvalable(R, R) if R has Evalable R

LinearlyExplicitOver Integer if R has Ring and R has LinearlyExplicitOver Integer

LinearlyExplicitOver R if R has Ring

MagmaWithUnit if R has SemiRing

Module R if R has CommutativeRing

NonAssociativeRing if R has Ring

NonAssociativeRng if R has Ring

NonAssociativeSemiRing if R has SemiRing

PartialDifferentialRing Symbol if R has Ring and R has PartialDifferentialRing Symbol

RectangularMatrixCategory(ndim, ndim, R, Row, Col)

RetractableTo Fraction Integer if R has RetractableTo Fraction Integer

RetractableTo Integer if R has RetractableTo Integer

unitsKnown if R has Ring