exportPartialTrace

Graph2P.exportPartialTrace(filename, filetype, p=1)

Exports the partial trace of the density matrix to a file.

Parameters:
  • filename (str) – path to desired output file.
  • filetype (str) –

    the filetype of the exported adjacency matrix.

    • 'txt' - an \(N\times N\) 2D array in text format.
    • 'bin' - an \(N\times N\) PETSc binary matrix.
  • p (int) – (1|2) - the particle to trace over.

For example, when p=1, \(\rho_2 = \text{Tr}_1(\rho_{12})\), where \(\rho_{12} = |\psi(t)\rangle\langle\psi(t)|\), is exported.

Fortran interface

This function calls the Fortran function partial_trace_mat() for bin filetypes, and the function partial_trace_array() otherwise.