NLA-lib Explorer

Matrix.IsHermitian.re_trace_mul_diagonal_mul_mul_diagonal

Library ยท theorem

The trace of \mathbf{C}\operatorname{diag}(\mathbf{x})\mathbf{C}\operatorname{diag}(\mathbf{y}) for Hermitian \mathbf{C} and real vectors \mathbf{x}, \mathbf{y} is the weighted sum \operatorname{Re} \operatorname{tr}\bigl(\mathbf{C}\operatorname{diag}(\mathbf{x})\mathbf{C} \operatorname{diag}(\mathbf{y})\bigr) = \sum_{i, j} \lvert \mathbf{C}_{i,j} \rvert^2 \mathbf{x}_j \mathbf{y}_i \,. In an eigenbasis of \mathbf{H} this expresses \operatorname{tr}(\mathbf{C} f(\mathbf{H}) \mathbf{C} g(\mathbf{H})) through the eigenvalues of \mathbf{H}.

Matrix.IsHermitian.re_trace_mul_diagonal_mul_mul_diagonal.{u_1, u_3} {๐•œ : Type u_1} [RCLike ๐•œ]
  {p : Type u_3} [Fintype p] [DecidableEq p] {C : Matrix p p ๐•œ} (hC : C.IsHermitian) (x y : p โ†’ โ„) :
  RCLike.re ((C * diagonal fun i โ†ฆ โ†‘(x i)) * C * diagonal fun i โ†ฆ โ†‘(y i)).trace =
    โˆ‘ i, โˆ‘ j, โ€–C i jโ€– ^ 2 * (x j * y i)

Full source on GitHub

Import NLAlib.Matrix.Functions.TracePowers.