Building Block Matrices

Block matrices can be constructed either by listing the blocks, or by joining together smaller matrices horizontally, vertically, or diagonally.

BlockMatrix(m, n, blocks): RngIntElt, RngIntElt, [ Mtrx ] -> Mtrx

The matrix constructed from the given block matrices, which should all have the same dimensions, and should be given as a sequence of \(m\cdot n\) block matrices (given in row major order, in other words listed across rows).

BlockMatrix(m, n, rows): RngIntElt, RngIntElt, [ [ Mtrx ] ] -> Mtrx
BlockMatrix(rows): [ [ Mtrx ] ] -> Mtrx

The matrix constructed from the given block matrices, which should all have the same dimensions, and should be given as a sequence of \(m\) rows, each containing \(n\) block matrices.

HorizontalJoin(X, Y): Mtrx, Mtrx -> Mtrx

Given a matrix \(X\) with \(r\) rows and \(c\) columns, and a matrix \(Y\) with \(r\) rows and \(d\) columns, both over the same coefficient ring \(R\), return the matrix over \(R\) with \(r\) rows and \((c+d)\) columns obtained by joining \(X\) and \(Y\) horizontally (placing \(Y\) to the right of \(X\)).

HorizontalJoin(Q): [ Mtrx ] -> Mtrx
HorizontalJoin(T): < Mtrx > -> Mtrx

Given a sequence \(Q\) or tuple \(T\) of matrices, each having the same number of rows and being over the same coefficient ring \(R\), return the matrix over \(R\) obtained by joining the elements of \(Q\) or \(T\) horizontally in order.

VerticalJoin(X, Y): Mtrx, Mtrx -> Mtrx

Given a matrix \(X\) with \(r\) rows and \(c\) columns, and a matrix \(Y\) with \(s\) rows and \(c\) columns, both over the same coefficient ring \(R\), return the matrix with \((r+s)\) rows and \(c\) columns over \(R\) obtained by joining \(X\) and \(Y\) vertically (placing \(Y\) underneath \(X\)).

VerticalJoin(Q): [ Mtrx ] -> Mtrx
VerticalJoin(T): < Mtrx > -> Mtrx

Given a sequence \(Q\) or tuple \(T\) of matrices, each having the same number of columns and being over the same coefficient ring \(R\), return the matrix over \(R\) obtained by joining the elements of \(Q\) or \(T\) vertically in order.

DiagonalJoin(X, Y): Mtrx, Mtrx -> Mtrx

Given matrices \(X\) with \(a\) rows and \(b\) columns and \(Y\) with \(c\) rows and \(d\) columns, both over the same coefficient ring \(R\), return the matrix with \((a+c)\) rows and \((b+d)\) columns over \(R\) obtained by joining \(X\) and \(Y\) diagonally (placing \(Y\) diagonally to the right of and underneath \(X\), with zero blocks above and below the diagonal).

DiagonalJoin(Q): [ Mtrx ] -> Mtrx
DiagonalJoin(T): < Mtrx > -> Mtrx

Given a sequence \(Q\) or tuple \(T\) of matrices, each being over the same coefficient ring \(R\), return the matrix over \(R\) obtained by joining the elements of \(Q\) or \(T\) diagonally in order.

KroneckerProduct(A, B): Mtrx, Mtrx -> Mtrx

Given an \(m \times n\) matrix \(A\) and a \(p \times q\) matrix \(B\), both over a ring \(R\), return the Kronecker product of \(A\) and \(B\), which is the \(mp\times nq\) matrix \(C\) over \(R\) such that the \(((i-1)p+r, (j-1)q+s)\)-th entry of \(C\) is the \((i,j)\)-th entry of \(A\) times the \((r,s)\)-th entry of \(B\), for \(1\leq i\le m\), \(1\leq j\leq n\), \(1\leq r\leq p\), and \(1\leq s\leq q\).