Skip to content

Commit

Permalink
refact(fock/pure): Simplify fock_probabilities
Browse files Browse the repository at this point in the history
Previously when calculating the particle number detection probabilities
the length of the state vector was calculated and used to slice the
result for unknown reason. This is unnecesarry because the result has
already the desired length, so this has been deleted.
  • Loading branch information
VHenrik007 committed Mar 7, 2023
1 parent 519d57e commit f6ac2cb
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions piquasso/_backends/fock/pure/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,7 @@ def get_particle_detection_probability(

@property
def fock_probabilities(self) -> np.ndarray:
cardinality = cutoff_cardinality(d=self._space.d, cutoff=self._config.cutoff)

return self._np.real((self._state_vector * self._np.conj(self._state_vector)))[
:cardinality
]
return self._np.real((self._state_vector * self._np.conj(self._state_vector)))

@property
def fock_probabilities_map(self) -> Dict[Tuple[int, ...], float]:
Expand Down

0 comments on commit f6ac2cb

Please sign in to comment.