mm.physics.fock.contract_states

mrmustard.physics.fock.contract_states(stateA, stateB, a_is_dm, b_is_dm, modes, normalize)[source]

Contracts two states in the specified modes. Assumes that the modes of B are a subset of the modes of A.

Parameters:
  • stateA – the first state

  • stateB – the second state

  • a_is_dm (bool) – whether the first state is a density matrix.

  • b_is_dm (bool) – whether the second state is a density matrix.

  • modes (List[int]) – the modes on which to contract the states.

  • normalize (bool) – whether to normalize the result

Returns:

the contracted state tensor (subsystem of A). Either ket or dm.

Return type:

Tensor