Row and column matrices #
This file provides results about row and column matrices.
Main definitions #
Matrix.replicateRow ι r : Matrix ι n α: the matrix where every row is the vectorr : n → αMatrix.replicateCol ι c : Matrix m ι α: the matrix where every column is the vectorc : m → αMatrix.updateRow M i r: update theith row ofMtorMatrix.updateCol M j c: update thejth column ofMtoc
Matrix.replicateCol ι u is the matrix with all columns equal to the vector u.
To get a column matrix with exactly one column,
Matrix.replicateCol (Fin 1) u is the canonical choice.
Equations
- Matrix.replicateCol ι w = Matrix.of fun (x : m) (x_1 : ι) => w x
Instances For
@[simp]
theorem
Matrix.replicateCol_apply
{m : Type u_2}
{α : Type v}
{ι : Type u_6}
(w : m → α)
(i : m)
(j : ι)
:
Matrix.replicateRow ι u is the matrix with all rows equal to the vector u.
To get a row matrix with exactly one row, Matrix.replicateRow (Fin 1) u is the canonical choice.
Equations
- Matrix.replicateRow ι v = Matrix.of fun (x : ι) (y : n) => v y
Instances For
@[simp]
theorem
Matrix.replicateRow_apply
{n : Type u_3}
{α : Type v}
{ι : Type u_6}
(v : n → α)
(i : ι)
(j : n)
:
@[simp]
theorem
Matrix.vecMulVec_one
{m : Type u_2}
{n : Type u_3}
{R : Type u_5}
[MulOneClass R]
(x : n → R)
:
@[simp]
theorem
Matrix.one_vecMulVec
{m : Type u_2}
{n : Type u_3}
{R : Type u_5}
[MulOneClass R]
(x : n → R)
:
@[simp]
theorem
Matrix.replicateCol_inj
{m : Type u_2}
{α : Type v}
{ι : Type u_6}
[Nonempty ι]
{v w : m → α}
:
@[simp]
@[simp]
@[simp]
theorem
Matrix.replicateRow_inj
{n : Type u_3}
{α : Type v}
{ι : Type u_6}
[Nonempty ι]
{v w : n → α}
:
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
theorem
Matrix.conjTranspose_replicateCol
{m : Type u_2}
{α : Type v}
{ι : Type u_6}
[Star α]
(v : m → α)
:
@[simp]
theorem
Matrix.conjTranspose_replicateRow
{m : Type u_2}
{α : Type v}
{ι : Type u_6}
[Star α]
(v : m → α)
:
theorem
Matrix.replicateRow_vecMul
{m : Type u_2}
{n : Type u_3}
{α : Type v}
{ι : Type u_6}
[Fintype m]
[NonUnitalNonAssocSemiring α]
(M : Matrix m n α)
(v : m → α)
:
theorem
Matrix.replicateCol_vecMul
{m : Type u_2}
{n : Type u_3}
{α : Type v}
{ι : Type u_6}
[Fintype m]
[NonUnitalNonAssocSemiring α]
(M : Matrix m n α)
(v : m → α)
:
theorem
Matrix.replicateCol_mulVec
{m : Type u_2}
{n : Type u_3}
{α : Type v}
{ι : Type u_6}
[Fintype n]
[NonUnitalNonAssocSemiring α]
(M : Matrix m n α)
(v : n → α)
:
theorem
Matrix.replicateRow_mulVec
{m : Type u_2}
{n : Type u_3}
{α : Type v}
{ι : Type u_6}
[Fintype n]
[NonUnitalNonAssocSemiring α]
(M : Matrix m n α)
(v : n → α)
:
theorem
Matrix.replicateRow_mulVec_eq_const
{m : Type u_2}
{α : Type v}
{ι : Type u_6}
[Fintype m]
[NonUnitalNonAssocSemiring α]
(v w : m → α)
:
theorem
Matrix.mulVec_replicateCol_eq_const
{m : Type u_2}
{α : Type v}
{ι : Type u_6}
[Fintype m]
[NonUnitalNonAssocSemiring α]
(v w : m → α)
:
theorem
Matrix.replicateRow_mul_replicateCol
{m : Type u_2}
{α : Type v}
{ι : Type u_6}
[Fintype m]
[Mul α]
[AddCommMonoid α]
(v w : m → α)
:
@[simp]
theorem
Matrix.replicateRow_mul_replicateCol_apply
{m : Type u_2}
{α : Type v}
{ι : Type u_6}
[Fintype m]
[Mul α]
[AddCommMonoid α]
(v w : m → α)
(i j : ι)
:
@[simp]
theorem
Matrix.diag_replicateCol_mul_replicateRow
{n : Type u_3}
{α : Type v}
{ι : Type u_6}
[Mul α]
[AddCommMonoid α]
[Unique ι]
(a b : n → α)
:
theorem
Matrix.vecMulVec_eq
{m : Type u_2}
{n : Type u_3}
{α : Type v}
(ι : Type u_6)
[Mul α]
[AddCommMonoid α]
[Unique ι]
(w : m → α)
(v : n → α)
:
Updating rows and columns #
def
Matrix.updateRow
{m : Type u_2}
{n : Type u_3}
{α : Type v}
[DecidableEq m]
(M : Matrix m n α)
(i : m)
(b : n → α)
:
Matrix m n α
Update, i.e. replace the ith row of matrix A with the values in b.
Equations
- M.updateRow i b = Matrix.of (Function.update M i b)
Instances For
def
Matrix.updateCol
{m : Type u_2}
{n : Type u_3}
{α : Type v}
[DecidableEq n]
(M : Matrix m n α)
(j : n)
(b : m → α)
:
Matrix m n α
Update, i.e. replace the jth column of matrix A with the values in b.
Equations
- M.updateCol j b = Matrix.of fun (i : m) => Function.update (M i) j (b i)
Instances For
@[simp]
theorem
Matrix.updateRow_self
{m : Type u_2}
{n : Type u_3}
{α : Type v}
{M : Matrix m n α}
{i : m}
{b : n → α}
[DecidableEq m]
:
@[simp]
theorem
Matrix.updateCol_self
{m : Type u_2}
{n : Type u_3}
{α : Type v}
{M : Matrix m n α}
{i : m}
{j : n}
{c : m → α}
[DecidableEq n]
:
@[simp]
theorem
Matrix.updateRow_ne
{m : Type u_2}
{n : Type u_3}
{α : Type v}
{M : Matrix m n α}
{i : m}
{b : n → α}
[DecidableEq m]
{i' : m}
(i_ne : i' ≠ i)
:
@[simp]
theorem
Matrix.updateCol_ne
{m : Type u_2}
{n : Type u_3}
{α : Type v}
{M : Matrix m n α}
{i : m}
{j : n}
{c : m → α}
[DecidableEq n]
{j' : n}
(j_ne : j' ≠ j)
:
@[simp]
theorem
Matrix.updateCol_subsingleton
{m : Type u_2}
{n : Type u_3}
{R : Type u_5}
[Subsingleton n]
(A : Matrix m n R)
(i : n)
(b : m → R)
:
@[simp]
theorem
Matrix.updateRow_subsingleton
{m : Type u_2}
{n : Type u_3}
{R : Type u_5}
[Subsingleton m]
(A : Matrix m n R)
(i : m)
(b : n → R)
:
theorem
Matrix.updateRow_conjTranspose
{m : Type u_2}
{n : Type u_3}
{α : Type v}
{M : Matrix m n α}
{j : n}
{c : m → α}
[DecidableEq n]
[Star α]
:
theorem
Matrix.updateCol_conjTranspose
{m : Type u_2}
{n : Type u_3}
{α : Type v}
{M : Matrix m n α}
{i : m}
{b : n → α}
[DecidableEq m]
[Star α]
:
@[simp]
theorem
Matrix.updateRow_eq_self
{m : Type u_2}
{n : Type u_3}
{α : Type v}
[DecidableEq m]
(A : Matrix m n α)
(i : m)
:
@[simp]
theorem
Matrix.updateCol_eq_self
{m : Type u_2}
{n : Type u_3}
{α : Type v}
[DecidableEq n]
(A : Matrix m n α)
(i : n)
:
@[simp]
theorem
Matrix.updateRow_zero_zero
{m : Type u_2}
{n : Type u_3}
{α : Type v}
[DecidableEq m]
[Zero α]
(i : m)
:
@[simp]
theorem
Matrix.updateCol_zero_zero
{m : Type u_2}
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
(i : n)
:
theorem
Matrix.diagonal_updateCol_single
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
(v : n → α)
(i : n)
(x : α)
:
theorem
Matrix.diagonal_updateRow_single
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
(v : n → α)
(i : n)
(x : α)
:
Updating rows and columns commutes in the obvious way with reindexing the matrix.
theorem
Matrix.updateRow_submatrix_equiv
{l : Type u_1}
{m : Type u_2}
{n : Type u_3}
{o : Type u_4}
{α : Type v}
[DecidableEq l]
[DecidableEq m]
(A : Matrix m n α)
(i : l)
(r : o → α)
(e : l ≃ m)
(f : o ≃ n)
:
theorem
Matrix.submatrix_updateRow_equiv
{l : Type u_1}
{m : Type u_2}
{n : Type u_3}
{o : Type u_4}
{α : Type v}
[DecidableEq l]
[DecidableEq m]
(A : Matrix m n α)
(i : m)
(r : n → α)
(e : l ≃ m)
(f : o ≃ n)
:
theorem
Matrix.updateCol_submatrix_equiv
{l : Type u_1}
{m : Type u_2}
{n : Type u_3}
{o : Type u_4}
{α : Type v}
[DecidableEq o]
[DecidableEq n]
(A : Matrix m n α)
(j : o)
(c : l → α)
(e : l ≃ m)
(f : o ≃ n)
:
theorem
Matrix.submatrix_updateCol_equiv
{l : Type u_1}
{m : Type u_2}
{n : Type u_3}
{o : Type u_4}
{α : Type v}
[DecidableEq o]
[DecidableEq n]
(A : Matrix m n α)
(j : n)
(c : m → α)
(e : l ≃ m)
(f : o ≃ n)
:
reindex versions of the above submatrix lemmas for convenience.
theorem
Matrix.single_eq_updateRow_zero
{m : Type u_2}
{n : Type u_3}
{α : Type v}
[DecidableEq m]
[DecidableEq n]
[Zero α]
(i : m)
(j : n)
(r : α)
:
theorem
Matrix.single_eq_updateCol_zero
{m : Type u_2}
{n : Type u_3}
{α : Type v}
[DecidableEq m]
[DecidableEq n]
[Zero α]
(i : m)
(j : n)
(r : α)
:
theorem
Matrix.updateRow_mulVec
{l : Type u_1}
{m : Type u_2}
{α : Type v}
[DecidableEq l]
[Fintype m]
[NonUnitalNonAssocSemiring α]
(A : Matrix l m α)
(i : l)
(c v : m → α)
:
theorem
Matrix.vecMul_updateCol
{m : Type u_2}
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Fintype m]
[NonUnitalNonAssocSemiring α]
(v : m → α)
(B : Matrix m n α)
(j : n)
(r : m → α)
:
theorem
Matrix.update_vecMulVec
{m : Type u_2}
{n : Type u_3}
{α : Type v}
[DecidableEq m]
[Mul α]
(u : m → α)
(v : n → α)
(i : m)
(a : α)
:
theorem
Matrix.vecMulVec_update
{m : Type u_2}
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Mul α]
(u : m → α)
(v : n → α)
(j : n)
(a : α)
:
theorem
Matrix.mul_single_eq_updateCol_zero
{l : Type u_1}
{m : Type u_2}
{n : Type u_3}
{α : Type v}
[DecidableEq m]
[DecidableEq n]
[Fintype m]
[NonUnitalNonAssocSemiring α]
(A : Matrix l m α)
(i : m)
(j : n)
(r : α)
:
theorem
Matrix.single_mul_eq_updateRow_zero
{l : Type u_1}
{m : Type u_2}
{n : Type u_3}
{α : Type v}
[DecidableEq l]
[DecidableEq m]
[Fintype m]
[NonUnitalNonAssocSemiring α]
(i : l)
(j : m)
(r : α)
(B : Matrix m n α)
:
@[simp]
theorem
Matrix.updateRow_zero_mul_updateCol_zero
{l : Type u_1}
{m : Type u_2}
{n : Type u_3}
{α : Type v}
[DecidableEq l]
[DecidableEq n]
[Fintype m]
[NonUnitalNonAssocSemiring α]
(i : l)
(r : m → α)
(j : n)
(c : m → α)
: