mm.physics.fock.trace

mrmustard.physics.fock.trace(dm, keep)[source]

Computes the partial trace of a density matrix. The indices of the density matrix are in the order (out0, …, outN-1, in0, …, inN-1). The indices to keep are a subset of the N ‘out’ indices (they count for the ‘in’ indices as well).

Parameters:
  • dm – the density matrix

  • keep (List[int]) – the modes to keep (0-based)