Skip to content

Commit

Permalink
Update base.py
Browse files Browse the repository at this point in the history
  • Loading branch information
co9olguy committed Jun 24, 2019
1 parent 8c24d5c commit bfdb992
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions strawberryfields/backends/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
loss
thermal_loss
measure_homodyne
measure_fock
Fock backends
------------------
Expand All @@ -99,7 +100,6 @@
cubic_phase
kerr_interaction
cross_kerr_interaction
measure_fock
Gaussian backends
---------------------
Expand Down Expand Up @@ -479,6 +479,22 @@ def measure_homodyne(self, phi, mode, select=None, **kwargs):
float: measured value
"""
raise NotImplementedError


def measure_fock(self, modes, select=None, **kwargs):
"""Measure the given modes in the Fock basis.
Updates the current state of the circuit to the conditional state of this measurement result.
Args:
modes (Sequence[int]): which modes to measure
select (None or Sequence[int]): If not None: desired values of the measurement results.
Enables post-selection on specific measurement results instead of random sampling.
``len(select) == len(modes)`` is required.
Returns:
tuple[int]: measurement results
"""
raise NotImplementedError

def is_vacuum(self, tol=0.0, **kwargs):
r"""Test whether the current circuit state is vacuum (up to given tolerance).
Expand Down Expand Up @@ -635,21 +651,6 @@ def cross_kerr_interaction(self, kappa, mode1, mode2):
"""
raise NotImplementedError

def measure_fock(self, modes, select=None, **kwargs):
"""Measure the given modes in the Fock basis.
Updates the current state of the circuit to the conditional state of this measurement result.
Args:
modes (Sequence[int]): which modes to measure
select (None or Sequence[int]): If not None: desired values of the measurement results.
Enables post-selection on specific measurement results instead of random sampling.
``len(select) == len(modes)`` is required.
Returns:
tuple[int]: measurement results
"""
raise NotImplementedError

def state(self, modes=None, **kwargs):
r"""Returns the state of the quantum simulation.
Expand Down Expand Up @@ -730,10 +731,6 @@ def kerr_interaction(self, kappa, mode):
def cross_kerr_interaction(self, kappa, mode1, mode2):
raise NotApplicableError

#def measure_fock(self, modes, select=None):
# print("hello from measure fock in the gaussian backend")
# raise NotApplicableError

def state(self, modes=None, **kwargs):
"""Returns the state of the quantum simulation.
Expand Down

0 comments on commit bfdb992

Please sign in to comment.