Diagonal matrices #
This file defines diagonal matrices and the AddCommMonoidWithOne structure on matrices.
Main definitions #
Matrix.diagonal d: matrix with the vectordalong the diagonalMatrix.diag M: the diagonal of a square matrixMatrix.instAddCommMonoidWithOne: matrices are an additive commutative monoid with one
diagonal d is the square matrix such that (diagonal d) i i = d i and (diagonal d) i j = 0
if i ≠ j.
This is available in bundled forms as:
Instances For
@[simp]
theorem Matrix.diagonal_apply_eq {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] (d : n → α) (i : n) :
@[simp]
theorem Matrix.diagonal_apply_ne {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] (d : n → α) {i j : n} (h : i ≠ j) :
theorem Matrix.diagonal_apply_ne' {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] (d : n → α) {i j : n} (h : j ≠ i) :
@[simp]
@[simp]
@[simp]
@[simp]
theorem Matrix.diagonal_transpose {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] (v : n → α) :
@[simp]
theorem Matrix.diagonal_add {n : Type u_3} {α : Type v} [DecidableEq n] [AddZeroClass α] (d₁ d₂ : n → α) :
@[simp]
theorem Matrix.diagonal_smul {n : Type u_3} {R : Type u_4} {α : Type v} [DecidableEq n] [Zero α] [SMulZeroClass R α] (r : R) (d : n → α) :
@[simp]
theorem Matrix.diagonal_neg {n : Type u_3} {α : Type v} [DecidableEq n] [NegZeroClass α] (d : n → α) :
@[simp]
theorem Matrix.diagonal_sub {n : Type u_3} {α : Type v} [DecidableEq n] [SubNegZeroMonoid α] (d₁ d₂ : n → α) :
@[instance_reducible]
instance Matrix.instNatCastOfZero {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] [NatCast α] :
Equations
- Matrix.instNatCastOfZero = { natCast := fun (m : ℕ) => Matrix.diagonal fun (x : n) => ↑m }
theorem Matrix.diagonal_natCast {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] [NatCast α] (m : ℕ) :
theorem Matrix.diagonal_natCast' {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] [NatCast α] (m : ℕ) :
theorem Matrix.diagonal_ofNat {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] [NatCast α] (m : ℕ) [m.AtLeastTwo] :
theorem Matrix.diagonal_ofNat' {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] [NatCast α] (m : ℕ) [m.AtLeastTwo] :
@[simp]
theorem Matrix.diagonal_eq_ofNat {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] [NatCast α] {d : n → α} {m : ℕ} [m.AtLeastTwo] :
@[instance_reducible]
instance Matrix.instIntCastOfZero {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] [IntCast α] :
Equations
- Matrix.instIntCastOfZero = { intCast := fun (m : ℤ) => Matrix.diagonal fun (x : n) => ↑m }
theorem Matrix.diagonal_intCast {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] [IntCast α] (m : ℤ) :
theorem Matrix.diagonal_intCast' {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] [IntCast α] (m : ℤ) :
theorem Matrix.map_natCast {n : Type u_3} {α : Type v} {β : Type w} [DecidableEq n] [AddMonoidWithOne α] [Zero β] {f : α → β} (h : f 0 = 0) (d : ℕ) :
theorem Matrix.map_ofNat {n : Type u_3} {α : Type v} {β : Type w} [DecidableEq n] [AddMonoidWithOne α] [Zero β] {f : α → β} (h : f 0 = 0) (d : ℕ) [d.AtLeastTwo] :
theorem Matrix.natCast_apply {n : Type u_3} {α : Type v} [DecidableEq n] [AddMonoidWithOne α] {i j : n} {d : ℕ} :
theorem Matrix.ofNat_apply {n : Type u_3} {α : Type v} [DecidableEq n] [AddMonoidWithOne α] {i j : n} {d : ℕ} [d.AtLeastTwo] :
theorem Matrix.map_intCast {n : Type u_3} {α : Type v} {β : Type w} [DecidableEq n] [AddGroupWithOne α] [Zero β] {f : α → β} (h : f 0 = 0) (d : ℤ) :
theorem Matrix.intCast_apply {n : Type u_3} {α : Type v} [DecidableEq n] [AddGroupWithOne α] {i j : n} {d : ℤ} :
@[simp]
theorem Matrix.col_diagonal {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] (d : n → α) (i : n) :
@[simp]
theorem Matrix.row_diagonal {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] (d : n → α) (j : n) :
@[instance_reducible]
Equations
- Matrix.one = { one := Matrix.diagonal fun (x : n) => 1 }
@[simp]
@[simp]
@[simp]
@[simp]
theorem Matrix.one_apply_ne {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] [One α] {i j : n} :
theorem Matrix.one_apply_ne' {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] [One α] {i j : n} :
theorem Matrix.one_eq_pi_single {n : Type u_3} {α : Type v} [DecidableEq n] [Zero α] [One α] {i j : n} :
@[instance_reducible]
instance Matrix.instAddMonoidWithOne {n : Type u_3} {α : Type v} [DecidableEq n] [AddMonoidWithOne α] :
AddMonoidWithOne (Matrix n n α)
Equations
- Matrix.instAddMonoidWithOne = { toNatCast := Matrix.instNatCastOfZero, toAddMonoid := Matrix.addMonoid, toOne := Matrix.one, natCast_zero := ⋯, natCast_succ := ⋯ }
@[instance_reducible]
instance Matrix.instAddGroupWithOne {n : Type u_3} {α : Type v} [DecidableEq n] [AddGroupWithOne α] :
AddGroupWithOne (Matrix n n α)
Equations
- One or more equations did not get rendered due to their size.
@[instance_reducible]
instance Matrix.instAddCommMonoidWithOne {n : Type u_3} {α : Type v} [DecidableEq n] [AddCommMonoidWithOne α] :
AddCommMonoidWithOne (Matrix n n α)
Equations
- One or more equations did not get rendered due to their size.
@[instance_reducible]
instance Matrix.instAddCommGroupWithOne {n : Type u_3} {α : Type v} [DecidableEq n] [AddCommGroupWithOne α] :
AddCommGroupWithOne (Matrix n n α)
Equations
- One or more equations did not get rendered due to their size.
The diagonal of a square matrix.
This is available in bundled forms as:
Instances For
@[simp]
@[simp]
@[simp]
@[simp]
theorem Matrix.transpose_natCast {n : Type u_3} {α : Type v} [DecidableEq n] [AddMonoidWithOne α] (d : ℕ) :
@[simp]
theorem Matrix.transpose_eq_natCast {n : Type u_3} {α : Type v} [DecidableEq n] [AddMonoidWithOne α] {M : Matrix n n α} {d : ℕ} :
@[simp]
theorem Matrix.transpose_ofNat {n : Type u_3} {α : Type v} [DecidableEq n] [AddMonoidWithOne α] (d : ℕ) [d.AtLeastTwo] :
@[simp]
theorem Matrix.transpose_eq_ofNat {n : Type u_3} {α : Type v} [DecidableEq n] [AddMonoidWithOne α] {M : Matrix n n α} {d : ℕ} [d.AtLeastTwo] :
@[simp]
theorem Matrix.transpose_intCast {n : Type u_3} {α : Type v} [DecidableEq n] [AddGroupWithOne α] (d : ℤ) :
@[simp]
theorem Matrix.transpose_eq_intCast {n : Type u_3} {α : Type v} [DecidableEq n] [AddGroupWithOne α] {M : Matrix n n α} {d : ℤ} :
theorem Matrix.submatrix_diagonal {l : Type u_1} {m : Type u_2} {α : Type v} [Zero α] [DecidableEq m] [DecidableEq l] (d : m → α) (e : l → m) (he : Function.Injective e) :
Given a (m × m) diagonal matrix defined by a map d : m → α, if the reindexing map e is
injective, then the resulting matrix is again diagonal.
theorem Matrix.submatrix_one {l : Type u_1} {m : Type u_2} {α : Type v} [Zero α] [One α] [DecidableEq m] [DecidableEq l] (e : l → m) (he : Function.Injective e) :
theorem Matrix.submatrix_ofNat {l : Type u_1} {m : Type u_2} {α : Type v} [Zero α] [NatCast α] [DecidableEq m] [DecidableEq l] (e : l → m) (he : Function.Injective e) (k : ℕ) [k.AtLeastTwo] :
simp lemmas for Matrix.submatrixs interaction with Matrix.diagonal, 1, and Matrix.mul
for when the mappings are bundled.
@[simp]
theorem Matrix.submatrix_diagonal_embedding {l : Type u_1} {m : Type u_2} {α : Type v} [Zero α] [DecidableEq m] [DecidableEq l] (d : m → α) (e : l ↪ m) :
@[simp]
theorem Matrix.submatrix_diagonal_equiv {l : Type u_1} {m : Type u_2} {α : Type v} [Zero α] [DecidableEq m] [DecidableEq l] (d : m → α) (e : l ≃ m) :
@[simp]
theorem Matrix.submatrix_one_embedding {l : Type u_1} {m : Type u_2} {α : Type v} [Zero α] [One α] [DecidableEq m] [DecidableEq l] (e : l ↪ m) :
@[simp]
theorem Matrix.submatrix_one_equiv {l : Type u_1} {m : Type u_2} {α : Type v} [Zero α] [One α] [DecidableEq m] [DecidableEq l] (e : l ≃ m) :
@[simp]
theorem Matrix.submatrix_equiv_eq_one_iff {l : Type u_1} {m : Type u_2} {α : Type v} [Zero α] [One α] [DecidableEq m] [DecidableEq l] {A : Matrix m m α} {e : l ≃ m} :
@[simp]
theorem Matrix.submatrix_ofNat_embedding {l : Type u_1} {m : Type u_2} {α : Type v} [Zero α] [NatCast α] [DecidableEq m] [DecidableEq l] (e : l ↪ m) (k : ℕ) [k.AtLeastTwo] :
@[simp]
theorem Matrix.submatrix_ofNat_equiv {l : Type u_1} {m : Type u_2} {α : Type v} [Zero α] [NatCast α] [DecidableEq m] [DecidableEq l] (e : l ≃ m) (k : ℕ) [k.AtLeastTwo] :
@[simp]
theorem Matrix.submatrix_equiv_eq_ofNat_iff {l : Type u_1} {m : Type u_2} {α : Type v} [Zero α] [NatCast α] [DecidableEq m] [DecidableEq l] {A : Matrix m m α} {e : l ≃ m} (k : ℕ) [k.AtLeastTwo] :