Mueller matrices: covariance matrix, parallel decompositions, indices of polarimetric purity and covariance/noise filtering
DefinitionArxiv1605_04704_BasicObjects of Sections 2, 4 and 5 of Gil, On optimal filtering of measured Mueller matrices (arXiv:1605.04704v3).
- Covariance matrix (eq. 2). To a real matrix is associated the Hermitian matrix of eq. (2), whose trace is . The map is a linear bijection onto the Hermitian matrices, and denotes its inverse. satisfies the covariance criterion when is positive semidefinite.
- Spectral data (eqs. 3-4). is a unitary matrix with columns , and are numbers such that . These are the normalized eigenvalues and the eigenvectors of .
- Pure parallel decompositions (eqs. 6, 13). A decomposition of into pure components is with , , and linearly independent unit vectors of in . An arbitrary decomposition is such a decomposition with .
- Components (eqs. 8, 10, 14, 15). The spectral components are . The 2D and 3D depolarizers are and . The ideal depolarizer is .
- Indices of polarimetric purity (eq. 11). , and .
- Covariance filtering (Section 4, eq. 23). For a measured , diagonalizes with . The filtered eigenvalues are , and , . The normalized eigenvalues of are .
- Noise filtering (Section 5, eqs. 24, 27). With , , and those of : (case ) and (case ).
Formalization Note is defined as the inverse function of (Lean's Function.invFun). It is the paper's on Hermitian matrices, which are the only matrices it is applied to; the paper does not print the explicit inverse (it cites Ref. [28]). The eigen-decomposition is taken as data in each statement, so every statement holds for every admissible choice of . Unit vectors are expressed as . Division by or is written as multiplication by or .
import Mathlib
/-!
J. J. Gil, *On optimal filtering of measured Mueller matrices*, arXiv:1605.04704v3 (2016):
the covariance (coherency) matrix of a Mueller matrix (Section 2, eqs. (2)-(4)), arbitrary and
spectral parallel decompositions (eqs. (6), (8), (13), (14)), the characteristic decomposition and
the indices of polarimetric purity (eqs. (9)-(11), (15)), the covariance filtering of a measured
Mueller matrix (Section 4, eq. (23)) and the noise-filtered matrices of Section 5 (eqs. (24), (27)).
-/
noncomputable section
namespace Arxiv1605_04704
open Matrix
/-- Eq. (2), PDF p. 1: the covariance (coherency) matrix `H(M)` of a real `4 × 4` matrix `M`
(indices `0..3` as in the paper, `m_kl = M k l`). -/
def cohMat (M : Matrix (Fin 4) (Fin 4) ℝ) : Matrix (Fin 4) (Fin 4) ℂ :=
(1 / 4 : ℂ) • !![
Complex.mk (M 0 0 + M 0 1 + M 1 0 + M 1 1) 0,
Complex.mk (M 0 2 + M 1 2) (M 0 3 + M 1 3),
Complex.mk (M 2 0 + M 2 1) (-(M 3 0 + M 3 1)),
Complex.mk (M 2 2 + M 3 3) (M 2 3 - M 3 2);
Complex.mk (M 0 2 + M 1 2) (-(M 0 3 + M 1 3)),
Complex.mk (M 0 0 - M 0 1 + M 1 0 - M 1 1) 0,
Complex.mk (M 2 2 - M 3 3) (-(M 2 3 + M 3 2)),
Complex.mk (M 2 0 - M 2 1) (-(M 3 0 - M 3 1));
Complex.mk (M 2 0 + M 2 1) (M 3 0 + M 3 1),
Complex.mk (M 2 2 - M 3 3) (M 2 3 + M 3 2),
Complex.mk (M 0 0 + M 0 1 - M 1 0 - M 1 1) 0,
Complex.mk (M 0 2 - M 1 2) (M 0 3 - M 1 3);
Complex.mk (M 2 2 + M 3 3) (-(M 2 3 - M 3 2)),
Complex.mk (M 2 0 - M 2 1) (M 3 0 - M 3 1),
Complex.mk (M 0 2 - M 1 2) (-(M 0 3 - M 1 3)),
Complex.mk (M 0 0 - M 0 1 - M 1 0 + M 1 1) 0]
/-- Section 2 ("Due to the biunivocal relation between H and M", PDF p. 2) and Section 4, step 5
(`M_cov = M(H_cov)`, PDF p. 4): the real `4 × 4` matrix `M(H)` whose covariance matrix is `H`.
Eq. (2) is a linear bijection from real `4 × 4` matrices onto `4 × 4` Hermitian matrices, so this
is its inverse on Hermitian matrices (the paper refers to Ref. [28] for the explicit formula). -/
def muellerOf (H : Matrix (Fin 4) (Fin 4) ℂ) : Matrix (Fin 4) (Fin 4) ℝ :=
Function.invFun cohMat H
/-- Eqs. (3)-(4), PDF pp. 1-2: `U` is a unitary matrix and `l = (λ̂₀, λ̂₁, λ̂₂, λ̂₃)` are the
normalized eigenvalues of `H(M)`, taken in decreasing order, with
`H(M) = m₀₀ U diag(λ̂₀, λ̂₁, λ̂₂, λ̂₃) U†` (`m₀₀ = M 0 0`). The columns `u_i` of `U` are the
eigenvectors. -/
def IsSpectralData (M : Matrix (Fin 4) (Fin 4) ℝ) (U : Matrix.unitaryGroup (Fin 4) ℂ)
(l : Fin 4 → ℝ) : Prop :=
Antitone l ∧
cohMat M = ((M 0 0 : ℝ) : ℂ) •
((U : Matrix (Fin 4) (Fin 4) ℂ) * Matrix.diagonal (fun i => (l i : ℂ)) *
star (U : Matrix (Fin 4) (Fin 4) ℂ))
/-- Eq. (6) (and its Mueller form (13)), PDF p. 2: a parallel decomposition of `M` into `n` pure
components, `H(M) = ∑ᵢ pᵢ m₀₀ (wᵢ ⊗ wᵢ†)` with nonnegative coefficients summing to one and
linearly independent unit covariance vectors `wᵢ` in `Range H(M)`. -/
def IsPureDecomp (M : Matrix (Fin 4) (Fin 4) ℝ) (n : ℕ) (p : Fin n → ℝ)
(w : Fin n → Fin 4 → ℂ) : Prop :=
(∀ i, 0 ≤ p i) ∧ (∑ i, p i = 1) ∧ (∀ i, ∑ j, Complex.normSq (w i j) = 1) ∧
(∀ i, w i ∈ LinearMap.range (Matrix.mulVecLin (cohMat M))) ∧ LinearIndependent ℂ w ∧
cohMat M = ∑ i, ((p i * M 0 0 : ℝ) : ℂ) • Matrix.vecMulVec (w i) (star (w i))
/-- Eqs. (6)-(7) and (13), PDF p. 2: an arbitrary decomposition of `M` is a pure parallel
decomposition with exactly `r = rank H(M)` components. -/
abbrev IsArbitraryDecomp (M : Matrix (Fin 4) (Fin 4) ℝ) (p : Fin (cohMat M).rank → ℝ)
(w : Fin (cohMat M).rank → Fin 4 → ℂ) : Prop :=
IsPureDecomp M (cohMat M).rank p w
/-- Eqs. (8), (14), PDF p. 2: the `i`-th spectral component `M_Ui = m₀₀ M̂_Ui`, the Mueller matrix
with covariance matrix `H_Ui = m₀₀ (uᵢ ⊗ uᵢ†)`, `uᵢ` the `i`-th column of `U` (`c = m₀₀`). -/
def specComp (U : Matrix.unitaryGroup (Fin 4) ℂ) (c : ℝ) (i : Fin 4) :
Matrix (Fin 4) (Fin 4) ℝ :=
muellerOf (((c : ℝ) : ℂ) • Matrix.vecMulVec (fun a => (U : Matrix (Fin 4) (Fin 4) ℂ) a i)
(star (fun a => (U : Matrix (Fin 4) (Fin 4) ℂ) a i)))
/-- Eqs. (10), (15), PDF p. 2-3: the 2D depolarizer `M_2`, with covariance matrix
`H_2 = (1/2) m₀₀ U diag(1,1,0,0) U†` (`c = m₀₀`). -/
def depol2 (U : Matrix.unitaryGroup (Fin 4) ℂ) (c : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
muellerOf (((c / 2 : ℝ) : ℂ) • ((U : Matrix (Fin 4) (Fin 4) ℂ) *
Matrix.diagonal ![(1 : ℂ), 1, 0, 0] * star (U : Matrix (Fin 4) (Fin 4) ℂ)))
/-- Eqs. (10), (15), PDF p. 2-3: the 3D depolarizer `M_3`, with covariance matrix
`H_3 = (1/3) m₀₀ U diag(1,1,1,0) U†` (`c = m₀₀`). -/
def depol3 (U : Matrix.unitaryGroup (Fin 4) ℂ) (c : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
muellerOf (((c / 3 : ℝ) : ℂ) • ((U : Matrix (Fin 4) (Fin 4) ℂ) *
Matrix.diagonal ![(1 : ℂ), 1, 1, 0] * star (U : Matrix (Fin 4) (Fin 4) ℂ)))
/-- Eq. (15) and the list after it, PDF p. 3: the ideal depolarizer `M_Δ0 = m₀₀ diag(1,0,0,0)`
(`c = m₀₀`); its covariance matrix is `H_Δ0 = (1/4) m₀₀ I₄` (eq. (10)). -/
def idealDepol (c : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
c • Matrix.diagonal ![(1 : ℝ), 0, 0, 0]
/-- Eq. (11), PDF p. 2: first index of polarimetric purity `P₁ = λ̂₀ - λ̂₁`. -/
def ipp1 (l : Fin 4 → ℝ) : ℝ := l 0 - l 1
/-- Eq. (11), PDF p. 2: second index of polarimetric purity `P₂ = λ̂₀ + λ̂₁ - 2λ̂₂`. -/
def ipp2 (l : Fin 4 → ℝ) : ℝ := l 0 + l 1 - 2 * l 2
/-- Eq. (11), PDF p. 2: third index of polarimetric purity `P₃ = λ̂₀ + λ̂₁ + λ̂₂ - 3λ̂₃`. -/
def ipp3 (l : Fin 4 → ℝ) : ℝ := l 0 + l 1 + l 2 - 3 * l 3
/-- Section 4, steps 1-2, PDF p. 4: `U` is a unitary matrix whose columns are orthonormal
eigenvectors of the Hermitian matrix `H_exp = H(M_exp)`, with eigenvalues `λ_exp,i = lam i` in
decreasing order: `H_exp = U diag(λ_exp,0, …, λ_exp,3) U†`. -/
def IsCovFilterData (Mexp : Matrix (Fin 4) (Fin 4) ℝ) (U : Matrix.unitaryGroup (Fin 4) ℂ)
(lam : Fin 4 → ℝ) : Prop :=
Antitone lam ∧
cohMat Mexp = (U : Matrix (Fin 4) (Fin 4) ℂ) * Matrix.diagonal (fun i => (lam i : ℂ)) *
star (U : Matrix (Fin 4) (Fin 4) ℂ)
/-- Section 4, step 3, PDF p. 4: the covariance-filtered eigenvalues `λ_cov,i`, obtained by
replacing every negative `λ_exp,i` by zero. -/
def covEig (lam : Fin 4 → ℝ) (i : Fin 4) : ℝ := max (lam i) 0
/-- Section 4, step 4, eq. (23), PDF p. 4: `H_cov = U diag(λ_cov,0, …, λ_cov,3) U†`. -/
def covH (U : Matrix.unitaryGroup (Fin 4) ℂ) (lam : Fin 4 → ℝ) : Matrix (Fin 4) (Fin 4) ℂ :=
(U : Matrix (Fin 4) (Fin 4) ℂ) * Matrix.diagonal (fun i => (covEig lam i : ℂ)) *
star (U : Matrix (Fin 4) (Fin 4) ℂ)
/-- Section 4, step 5, PDF p. 4: the covariance-filtered Mueller matrix `M_cov = M(H_cov)`. -/
def covMueller (U : Matrix.unitaryGroup (Fin 4) ℂ) (lam : Fin 4 → ℝ) :
Matrix (Fin 4) (Fin 4) ℝ :=
muellerOf (covH U lam)
/-- Eq. (4) applied to `H_cov`, PDF pp. 2, 4: the normalized eigenvalues
`λ̂_i = λ_cov,i / tr H_cov` of `M_cov`, in decreasing order. -/
def covLhat (lam : Fin 4 → ℝ) (i : Fin 4) : ℝ := covEig lam i / ∑ j, covEig lam j
/-- Section 5, case b.1, eq. (24), PDF p. 4: the noise-filtered matrix
`M_f = [M_cov - (1 - P₃) M_Δ0] / P₃`, with `P_i` the indices of polarimetric purity of `M_cov`
and `M_Δ0` built with the `m₀₀` of `M_cov`. -/
def filt3 (U : Matrix.unitaryGroup (Fin 4) ℂ) (lam : Fin 4 → ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
(1 / ipp3 (covLhat lam)) •
(covMueller U lam - (1 - ipp3 (covLhat lam)) • idealDepol (covMueller U lam 0 0))
/-- Section 5, case c.1, eq. (27), PDF p. 5: the noise-filtered matrix
`M_f = [M_cov - (1 - P₃) M_Δ0 - (P₃ - P₂) M_3] / P₂`, with `P_i`, `M_Δ0` and `M_3` those of
`M_cov`. -/
def filt2 (U : Matrix.unitaryGroup (Fin 4) ℂ) (lam : Fin 4 → ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
(1 / ipp2 (covLhat lam)) •
(covMueller U lam - (1 - ipp3 (covLhat lam)) • idealDepol (covMueller U lam 0 0) -
(ipp3 (covLhat lam) - ipp2 (covLhat lam)) • depol3 U (covMueller U lam 0 0))
end Arxiv1605_04704
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Covariance matrix . For any real matrix , with no further conditions such as being a physical Mueller matrix, is the complex matrix
By inspection, every entry below the diagonal is the complex conjugate of its mirror entry, so is always Hermitian. Its diagonal sums to , so .
Inverse map . For an arbitrary complex matrix , is a real matrix chosen as follows:
- If some real satisfies , then is one such .
- If several such exist, the choice among them is unspecified. The definition itself does not assert that the preimage is unique.
- If no such exists (for instance, if is not Hermitian), then is some fixed but unspecified real matrix with no stated relation to .
No explicit formula is given.
Spectral data of . For a real matrix , a complex unitary matrix (), and a real -tuple , the triple is called spectral data when both of the following hold:
The definition does not directly require the to be nonnegative or to sum to . Because , the sum follows whenever . In the degenerate case , the condition reduces to , and then any unitary and any non-increasing qualify.
Pure parallel decomposition with components. For a real matrix , a natural number , real weights , and vectors , the data is called a pure decomposition of when all of the following hold:
- for every .
- .
- Each has unit Euclidean norm: .
- Each lies in the column space (range) of .
- The family is linearly independent over . In particular the are pairwise distinct.
- The decomposition identity holds:
where is the outer-product matrix with entry .
Some consequences of these conditions:
- is impossible, because the empty sum of weights is .
- Linear independence inside the range forces .
- Individual weights may be zero.
- The are not required to be orthogonal.
- is not otherwise tied to the rank.
Arbitrary decomposition. This is a pure decomposition of in the sense just described, with the number of components fixed to be exactly , the complex rank. So and must satisfy all six conditions above with . If , then and no arbitrary decomposition exists.
Spectral component . For a unitary , a real number , and an index , let be the -th column of . Then
the real matrix returned by the inverse map described above, applied to times the outer product of with itself. The number is a free parameter with no link to any particular in this definition.
Two-dimensional depolarizer . For a unitary and a real ,
Three-dimensional depolarizer . For a unitary and a real ,
Ideal depolarizer . For a real , is the real matrix
Its only nonzero entry is in position . It is defined directly, not via the inverse map .
First index of polarimetric purity. For any real -tuple , with no ordering, sign, or normalization assumption,
Second index of polarimetric purity. For any real -tuple , with no assumptions,
Third index of polarimetric purity. For any real -tuple , with no assumptions,
Covariance-filter data. For a real matrix , a unitary , and a real -tuple , the triple is called covariance-filter data when both of the following hold:
There is no factor here, unlike in the spectral data. The may be negative.
Filtered eigenvalues. For a real -tuple and an index ,
so negative entries are replaced by and nonnegative entries are kept.
Filtered covariance matrix . For a unitary and a real -tuple ,
This definition takes and as arbitrary inputs. It does not refer to any measured matrix and does not require to be ordered.
Filtered Mueller matrix . For a unitary and a real -tuple ,
the real matrix produced by the inverse map applied to the filtered covariance matrix.
Normalized filtered eigenvalues . For a real -tuple and an index ,
The denominator equals the trace of for any unitary . Edge cases:
- If every , the denominator is , and division by zero is taken to give . In that case every .
- The are non-increasing in only if is. This definition itself imposes no ordering.
Noise-filtered matrix . For a unitary and a real -tuple , write:
- ;
- for the entry of ;
- , with the normalized filtered eigenvalues defined above.
Then
where . If , then is taken to be and is the zero matrix. No hypothesis on or beyond their types is imposed.
Noise-filtered matrix . For a unitary and a real -tuple , write:
- ;
- for the entry of ;
- and , with the normalized filtered eigenvalues.
Then
Here , and uses the same as . If , then is taken to be and is the zero matrix. No hypothesis on or beyond their types is imposed.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.