Block Matrices #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
Main definitions #
matrix.from_blocks
: build a block matrix out of 4 blocksmatrix.to_blocks₁₁
,matrix.to_blocks₁₂
,matrix.to_blocks₂₁
,matrix.to_blocks₂₂
: extract each of the four blocks frommatrix.from_blocks
.matrix.block_diagonal
: block diagonal of equally sized blocks. On square blocks, this is a ring homomorphisms,matrix.block_diagonal_ring_hom
.matrix.block_diag
: extract the blocks from the diagonal of a block diagonal matrix.matrix.block_diagonal'
: block diagonal of unequally sized blocks. On square blocks, this is a ring homomorphisms,matrix.block_diagonal'_ring_hom
.matrix.block_diag'
: extract the blocks from the diagonal of a block diagonal matrix.
Two block matrices are equal if their blocks are equal.
A 2x2 block matrix is block diagonal if the blocks outside of the diagonal vanish
Equations
- A.is_two_block_diagonal = (A.to_blocks₁₂ = 0 ∧ A.to_blocks₂₁ = 0)
Let p
pick out certain rows and columns of a square matrix M
. Then
to_square_block_prop M p
is the corresponding block matrix.
Equations
- M.to_square_block_prop p = M.to_block (λ (a : m), p a) (λ (a : m), p a)
Let b
map rows and columns of a square matrix M
to blocks. Then
to_square_block M b k
is the block k
matrix.
Equations
- M.to_square_block b k = M.to_square_block_prop (λ (a : m), b a = k)
matrix.block_diagonal M
turns a homogenously-indexed collection of matrices
M : o → matrix m n α'
into a m × o
-by-n × o
block matrix which has the entries of M
along
the diagonal and zero elsewhere.
See also matrix.block_diagonal'
if the matrices may not have the same size everywhere.
matrix.block_diagonal
as an add_monoid_hom
.
Equations
- matrix.block_diagonal_add_monoid_hom m n o α = {to_fun := matrix.block_diagonal (add_zero_class.to_has_zero α), map_zero' := _, map_add' := _}
matrix.block_diagonal
as a ring_hom
.
Equations
- matrix.block_diagonal_ring_hom m o α = {to_fun := matrix.block_diagonal (mul_zero_class.to_has_zero α), map_one' := _, map_mul' := _, map_zero' := _, map_add' := _}
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.block_diagonal
.
Equations
- M.block_diag k = ⇑matrix.of (λ (i : m) (j : n), M (i, k) (j, k))
matrix.block_diag
as an add_monoid_hom
.
Equations
- matrix.block_diag_add_monoid_hom m n o α = {to_fun := matrix.block_diag α, map_zero' := _, map_add' := _}
matrix.block_diagonal' 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.block_diagonal
.
Equations
- matrix.block_diagonal' M = ⇑matrix.of (λ (_x : Σ (i : o), m' i), matrix.block_diagonal'._match_2 M _x)
- matrix.block_diagonal'._match_2 M ⟨k, i⟩ = λ (_x : Σ (i : o), n' i), matrix.block_diagonal'._match_1 M k i _x
- matrix.block_diagonal'._match_1 M k i ⟨k', j⟩ = dite (k = k') (λ (h : k = k'), M k i (cast _ j)) (λ (h : ¬k = k'), 0)
matrix.block_diagonal'
as an add_monoid_hom
.
Equations
- matrix.block_diagonal'_add_monoid_hom m' n' α = {to_fun := matrix.block_diagonal' (add_zero_class.to_has_zero α), map_zero' := _, map_add' := _}
matrix.block_diagonal'
as a ring_hom
.
Equations
- matrix.block_diagonal'_ring_hom m' α = {to_fun := matrix.block_diagonal' (mul_zero_class.to_has_zero α), map_one' := _, map_mul' := _, map_zero' := _, map_add' := _}
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.block_diagonal'
.
matrix.block_diag'
as an add_monoid_hom
.
Equations
- matrix.block_diag'_add_monoid_hom m' n' α = {to_fun := matrix.block_diag' α, map_zero' := _, map_add' := _}