triqs.atom_diag.atom_diag.trace_rho_op

triqs.atom_diag.atom_diag.trace_rho_op()

Dispatched C++ function(s).

[1] (density_matrix: [ndarray[float, 2]], op: Operator, atom: AtomDiagReal)
  -> float

[2] (density_matrix: [ndarray[complex, 2]], op: Operator, atom: AtomDiagComplex)
  -> complex

Compute the trace of a many-body operator weighted by a block-diagonal density matrix.

Evaluates

\[\mathrm{Tr}\,(\hat\rho\, \hat O) = \sum_{B} \mathrm{Tr}\,(\rho_B\, O_{BB}),\]

where \(\hat\rho\) is provided as a list of diagonal blocks (one per invariant subspace of atom) and only the diagonal blocks \(O_{BB}\) of \(\hat O\) contribute. Useful for computing expectation values of arbitrary observables once a density matrix has been built.

Parameters:
density_matrix[ndarray[float, 2]], [ndarray[complex, 2]]

Density matrix as a list of diagonal blocks, indexed by subspace index \(B\).

opOperator, Operator

Operator to be averaged.

atomAtomDiagReal, AtomDiagComplex

Solved diagonalization problem.

Returns:
[1]float

Expectation value of \(\hat O\) under the given density matrix.

[2]complex

Expectation value of \(\hat O\) under the given density matrix.