Hadamard product of matrices #
This file defines the Hadamard product matrix.hadamard
and contains basic properties about them.
Main definition #
matrix.hadamard
: defines the Hadamard product, which is the pointwise product of two matrices of the same size.
Notation #
⊙
: the Hadamard productmatrix.hadamard
;
References #
Tags #
hadamard product, hadamard
@[simp]
def
matrix.hadamard
{α : Type u_1}
{m : Type u_4}
{n : Type u_5}
[has_mul α]
(A B : matrix m n α) :
matrix m n α
matrix.hadamard
defines the Hadamard product,
which is the pointwise product of two matrices of the same size.
theorem
matrix.hadamard_comm
{α : Type u_1}
{m : Type u_4}
{n : Type u_5}
(A B : matrix m n α)
[comm_semigroup α] :
@[simp]
theorem
matrix.smul_hadamard
{α : Type u_1}
{m : Type u_4}
{n : Type u_5}
{R : Type u_6}
(A B : matrix m n α)
[has_mul α]
[has_scalar R α]
[is_scalar_tower R α α]
(k : R) :
@[simp]
theorem
matrix.hadamard_smul
{α : Type u_1}
{m : Type u_4}
{n : Type u_5}
{R : Type u_6}
(A B : matrix m n α)
[has_mul α]
[has_scalar R α]
[smul_comm_class R α α]
(k : R) :
@[simp]
theorem
matrix.hadamard_zero
{α : Type u_1}
{m : Type u_4}
{n : Type u_5}
(A : matrix m n α)
[mul_zero_class α] :
@[simp]
theorem
matrix.zero_hadamard
{α : Type u_1}
{m : Type u_4}
{n : Type u_5}
(A : matrix m n α)
[mul_zero_class α] :
theorem
matrix.hadamard_one
{α : Type u_1}
{n : Type u_5}
[decidable_eq n]
[mul_zero_one_class α]
(M : matrix n n α) :
M ⊙ 1 = matrix.diagonal (λ (i : n), M i i)
theorem
matrix.one_hadamard
{α : Type u_1}
{n : Type u_5}
[decidable_eq n]
[mul_zero_one_class α]
(M : matrix n n α) :
1 ⊙ M = matrix.diagonal (λ (i : n), M i i)
theorem
matrix.diagonal_hadamard_diagonal
{α : Type u_1}
{n : Type u_5}
[decidable_eq n]
[mul_zero_class α]
(v w : n → α) :
matrix.diagonal v ⊙ matrix.diagonal w = matrix.diagonal (v * w)
theorem
matrix.dot_product_vec_mul_hadamard
{α : Type u_1}
{m : Type u_4}
{n : Type u_5}
(R : Type u_6)
(A B : matrix m n α)
[fintype m]
[fintype n]
[semiring α]
[semiring R]
[module R α]
[decidable_eq m]
[decidable_eq n]
(v : m → α)
(w : n → α) :
matrix.vec_mul v (A ⊙ B) ⬝ᵥ w = ⇑(matrix.trace m R α) (matrix.diagonal v ⬝ A ⬝ (B ⬝ matrix.diagonal w)ᵀ)