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
def
Matrix.hadamard
{α : Type u_1}
{m : Type u_2}
{n : Type u_3}
[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.
Instances For
Equations
- Matrix.«term_⊙_» = Lean.ParserDescr.trailingNode `Matrix.«term_⊙_» 100 100 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊙ ") (Lean.ParserDescr.cat `term 101))
Instances For
theorem
Matrix.hadamard_comm
{α : Type u_1}
{m : Type u_2}
{n : Type u_3}
(A B : Matrix m n α)
[CommSemigroup α]
:
A.hadamard B = B.hadamard A
@[simp]
theorem
Matrix.hadamard_zero
{α : Type u_1}
{m : Type u_2}
{n : Type u_3}
(A : Matrix m n α)
[MulZeroClass α]
:
A.hadamard 0 = 0
@[simp]
theorem
Matrix.zero_hadamard
{α : Type u_1}
{m : Type u_2}
{n : Type u_3}
(A : Matrix m n α)
[MulZeroClass α]
:
Matrix.hadamard 0 A = 0
theorem
Matrix.hadamard_one
{α : Type u_1}
{n : Type u_3}
[DecidableEq n]
[MulZeroOneClass α]
(M : Matrix n n α)
:
M.hadamard 1 = Matrix.diagonal fun (i : n) => M i i
theorem
Matrix.one_hadamard
{α : Type u_1}
{n : Type u_3}
[DecidableEq n]
[MulZeroOneClass α]
(M : Matrix n n α)
:
Matrix.hadamard 1 M = Matrix.diagonal fun (i : n) => M i i
theorem
Matrix.diagonal_hadamard_diagonal
{α : Type u_1}
{n : Type u_3}
[DecidableEq n]
[MulZeroClass α]
(v w : n → α)
:
(Matrix.diagonal v).hadamard (Matrix.diagonal w) = Matrix.diagonal (v * w)
theorem
Matrix.dotProduct_vecMul_hadamard
{α : Type u_1}
{m : Type u_2}
{n : Type u_3}
(A B : Matrix m n α)
[Fintype m]
[Fintype n]
[Semiring α]
[DecidableEq m]
[DecidableEq n]
(v : m → α)
(w : n → α)
:
Matrix.vecMul v (A.hadamard B) ⬝ᵥ w = (Matrix.diagonal v * A * (B * Matrix.diagonal w).transpose).trace