Matrices
Equations
- matrix.col w x y = w x
Equations
- matrix.row v x y = v y
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
The add_monoid_hom
between spaces of matrices induced by an add_monoid_hom
between their
coefficients.
diagonal d
is the square matrix such that (diagonal d) i i = d i
and (diagonal d) i j = 0
if i ≠ j
.
Equations
- matrix.diagonal d = λ (i j : n), ite (i = j) (d i) 0
Equations
- matrix.has_one = {one := matrix.diagonal (λ (_x : n), 1)}
dot_product v w
is the sum of the entrywise products v i * w i
Equations
- matrix.dot_product v w = finset.univ.sum (λ (i : m), v i * w i)
Equations
- M.mul N = λ (i : l) (k : n), matrix.dot_product (λ (j : m), M i j) (λ (j : m), N j k)
Equations
- matrix.has_mul = {mul := matrix.mul _inst_6}
Equations
- matrix.semigroup = {mul := has_mul.mul matrix.has_mul, mul_assoc := _}
Equations
- matrix.monoid = {mul := semigroup.mul matrix.semigroup, mul_assoc := _, one := 1, one_mul := _, mul_one := _}
Equations
- matrix.semiring = {add := add_comm_monoid.add matrix.add_comm_monoid, add_assoc := _, zero := add_comm_monoid.zero matrix.add_comm_monoid, zero_add := _, add_zero := _, add_comm := _, mul := monoid.mul matrix.monoid, mul_assoc := _, one := monoid.one matrix.monoid, one_mul := _, mul_one := _, zero_mul := _, mul_zero := _, left_distrib := _, right_distrib := _}
The ring_hom
between spaces of square matrices induced by a ring_hom
between their
coefficients.
Equations
- matrix.ring = {add := semiring.add matrix.semiring, add_assoc := _, zero := semiring.zero matrix.semiring, zero_add := _, add_zero := _, neg := add_comm_group.neg matrix.add_comm_group, add_left_neg := _, add_comm := _, mul := semiring.mul matrix.semiring, mul_assoc := _, one := semiring.one matrix.semiring, one_mul := _, mul_one := _, left_distrib := _, right_distrib := _}
Equations
Equations
- matrix.semimodule = pi.semimodule m (λ (a : m), n → β) α
The ring homomorphism α →+* matrix n n α
sending a
to the diagonal matrix with a
on the diagonal.
Equations
- matrix.vec_mul_vec w v x y = w x * v y
Equations
- M.mul_vec v i = matrix.dot_product (λ (j : n), M i j) v
Equations
- matrix.vec_mul v M j = matrix.dot_product v (λ (i : m), M i j)
Equations
- _ = _
std_basis_matrix i j a
is the matrix with a
in the i
-th row, j
-th column,
and zeroes elsewhere.
row_col
section
Simplification lemmas for matrix.row
and matrix.col
.
Update, i.e. replace the i
th row of matrix A
with the values in b
.
Equations
- M.update_row i b = function.update M i b
Update, i.e. replace the i
th column of matrix A
with the values in b
.
Equations
- M.update_column j b = λ (i : n), function.update (M i) j (b i)
We can form a single large matrix by flattening smaller 'block' matrices of compatible dimensions.
Equations
- A.from_blocks B C D = sum.elim (λ (i : n), sum.elim (A i) (B i)) (λ (i : o), sum.elim (C i) (D i))
Given a matrix whose row and column indexes are sum types, we can extract the correspnding "top left" submatrix.
Equations
- M.to_blocks₁₁ = λ (i : n) (j : l), M (sum.inl i) (sum.inl j)
Given a matrix whose row and column indexes are sum types, we can extract the correspnding "top right" submatrix.
Equations
- M.to_blocks₁₂ = λ (i : n) (j : m), M (sum.inl i) (sum.inr j)
Given a matrix whose row and column indexes are sum types, we can extract the correspnding "bottom left" submatrix.
Equations
- M.to_blocks₂₁ = λ (i : o) (j : l), M (sum.inr i) (sum.inl j)
Given a matrix whose row and column indexes are sum types, we can extract the correspnding "bottom right" submatrix.
Equations
- M.to_blocks₂₂ = λ (i : o) (j : m), M (sum.inr i) (sum.inr j)