sf.physics.fock.apply_kraus_to_ket

mrmustard.physics.fock.apply_kraus_to_ket(kraus, ket, kraus_in_modes, kraus_out_modes=None)[source]

Applies a kraus operator to a ket. It assumes that the ket is indexed as left_1, …, left_n.

The kraus op has indices that contract with the ket (kraus_in_modes) and indices that are left over (kraus_out_modes). The final index order will be sorted (note that an index appearing in both kraus_in_modes and kraus_out_modes will replace the original index).

Parameters:
  • kraus (array) – the kraus operator to be applied

  • ket (array) – the ket to which the operator is applied

  • kraus_in_modes (list of ints) – the indices (counting from 0) of the kraus operator that contract with the ket

  • kraus_out_modes (list of ints) – the indices (counting from 0) of the kraus operator that are leftover

Returns:

the resulting ket with indices as kraus_out_modes + uncontracted ket indices

Return type:

array