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)Import NLAlib.Matrix.Functions.TracePowers.