Block Matrices #
Main definitions #
Matrix.fromBlocks
: build a block matrix out of 4 blocksMatrix.toBlocks₁₁
,Matrix.toBlocks₁₂
,Matrix.toBlocks₂₁
,Matrix.toBlocks₂₂
: extract each of the four blocks fromMatrix.fromBlocks
.Matrix.blockDiagonal
: block diagonal of equally sized blocks. On square blocks, this is a ring homomorphisms,Matrix.blockDiagonalRingHom
.Matrix.blockDiag
: extract the blocks from the diagonal of a block diagonal matrix.Matrix.blockDiagonal'
: block diagonal of unequally sized blocks. On square blocks, this is a ring homomorphisms,Matrix.blockDiagonal'RingHom
.Matrix.blockDiag'
: extract the blocks from the diagonal of a block diagonal matrix.
We can form a single large matrix by flattening smaller 'block' matrices of compatible dimensions.
Equations
- Matrix.fromBlocks A B C D = Matrix.of (Sum.elim (fun (i : n) => Sum.elim (A i) (B i)) fun (i : o) => Sum.elim (C i) (D i))
Instances For
Given a matrix whose row and column indexes are sum types, we can extract the corresponding "top left" submatrix.
Equations
- Matrix.toBlocks₁₁ M = Matrix.of fun (i : n) (j : l) => M (Sum.inl i) (Sum.inl j)
Instances For
Given a matrix whose row and column indexes are sum types, we can extract the corresponding "top right" submatrix.
Equations
- Matrix.toBlocks₁₂ M = Matrix.of fun (i : n) (j : m) => M (Sum.inl i) (Sum.inr j)
Instances For
Given a matrix whose row and column indexes are sum types, we can extract the corresponding "bottom left" submatrix.
Equations
- Matrix.toBlocks₂₁ M = Matrix.of fun (i : o) (j : l) => M (Sum.inr i) (Sum.inl j)
Instances For
Given a matrix whose row and column indexes are sum types, we can extract the corresponding "bottom right" submatrix.
Equations
- Matrix.toBlocks₂₂ M = Matrix.of fun (i : o) (j : m) => M (Sum.inr i) (Sum.inr j)
Instances For
A 2x2 block matrix is block diagonal if the blocks outside of the diagonal vanish
Equations
- Matrix.IsTwoBlockDiagonal A = (Matrix.toBlocks₁₂ A = 0 ∧ Matrix.toBlocks₂₁ A = 0)
Instances For
Let p
pick out certain rows and q
pick out certain columns of a matrix M
. Then
toBlock M p q
is the corresponding block matrix.
Equations
- Matrix.toBlock M p q = Matrix.submatrix M Subtype.val Subtype.val
Instances For
Let p
pick out certain rows and columns of a square matrix M
. Then
toSquareBlockProp M p
is the corresponding block matrix.
Equations
- Matrix.toSquareBlockProp M p = Matrix.toBlock M (fun (a : m) => p a) fun (a : m) => p a
Instances For
Let b
map rows and columns of a square matrix M
to blocks. Then
toSquareBlock M b k
is the block k
matrix.
Equations
- Matrix.toSquareBlock M b k = Matrix.toSquareBlockProp M fun (a : m) => b a = k
Instances For
Matrix.blockDiagonal M
turns a homogenously-indexed collection of matrices
M : o → Matrix m n α'
into an m × o
-by-n × o
block matrix which has the entries of M
along
the diagonal and zero elsewhere.
See also Matrix.blockDiagonal'
if the matrices may not have the same size everywhere.
Equations
- Matrix.blockDiagonal M = Matrix.of fun (x : m × o) (x_1 : n × o) => match x with | (i, k) => match x_1 with | (j, k') => if k = k' then M k i j else 0
Instances For
Matrix.blockDiagonal
as an AddMonoidHom
.
Equations
- Matrix.blockDiagonalAddMonoidHom m n o α = { toZeroHom := { toFun := Matrix.blockDiagonal, map_zero' := ⋯ }, map_add' := ⋯ }
Instances For
Matrix.blockDiagonal
as a RingHom
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Extract a block from the diagonal of a block diagonal matrix.
This is the block form of Matrix.diag
, and the left-inverse of Matrix.blockDiagonal
.
Equations
- Matrix.blockDiag M k = Matrix.of fun (i : m) (j : n) => M (i, k) (j, k)
Instances For
Matrix.blockDiag
as an AddMonoidHom
.
Equations
- Matrix.blockDiagAddMonoidHom m n o α = { toZeroHom := { toFun := Matrix.blockDiag, map_zero' := ⋯ }, map_add' := ⋯ }
Instances For
Matrix.blockDiagonal' M
turns M : Π i, Matrix (m i) (n i) α
into a
Σ i, m i
-by-Σ i, n i
block matrix which has the entries of M
along the diagonal
and zero elsewhere.
This is the dependently-typed version of Matrix.blockDiagonal
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Matrix.blockDiagonal'
as an AddMonoidHom
.
Equations
- Matrix.blockDiagonal'AddMonoidHom m' n' α = { toZeroHom := { toFun := Matrix.blockDiagonal', map_zero' := ⋯ }, map_add' := ⋯ }
Instances For
Matrix.blockDiagonal'
as a RingHom
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Extract a block from the diagonal of a block diagonal matrix.
This is the block form of Matrix.diag
, and the left-inverse of Matrix.blockDiagonal'
.
Equations
- Matrix.blockDiag' M k = Matrix.of fun (i : m' k) (j : n' k) => M { fst := k, snd := i } { fst := k, snd := j }
Instances For
Matrix.blockDiag'
as an AddMonoidHom
.
Equations
- Matrix.blockDiag'AddMonoidHom m' n' α = { toZeroHom := { toFun := Matrix.blockDiag', map_zero' := ⋯ }, map_add' := ⋯ }