Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions perceval/utils/states.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,9 @@ def merge(self, other: State) -> State:
def __add__(self, other) -> State | StateVector | BSDistribution:
return StateVector()

def __radd__(self, other) -> State | StateVector | BSDistribution:
return StateVector()

def __sub__(self, other) -> State | StateVector | BSDistribution:
return StateVector()

def __rsub__(self, other) -> State | StateVector | BSDistribution:
return StateVector()

@property
def has_polarization(self) -> bool:
return False
Expand All @@ -169,24 +163,6 @@ def has_polarization(self) -> bool:
def has_annotations(self) -> bool:
return False

def separate_state(self) -> list[FockState]:
"""
:return: A list of states where each state represents a collection of indistinguishable photons from the original state
"""

def split_state(self) -> dict[int, FockState]:
"""
:return: A dict of states where each state represents a collection of indistinguishable photons from the original state,
associated with the noise tag they were defined with.
"""

def partition(self, photon_nb: list[int]) -> list[list[FockState]]:
"""
:param photon_nb: a list of photon numbers. The sum of this list must be equal to self.n
:return: A list containing all lists of states such that the merge of all these states is self,
where each state of the sublists has the number of photons specified in ``photon_nb``.
"""

def clear_annotations(self) -> FockState:
"""
:return: A new state where the photons are on the same modes as self, with no noise or annotations.
Expand Down
44 changes: 44 additions & 0 deletions tests/utils/test_basicstate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# MIT License
#
# Copyright (c) 2022 Quandela
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# As a special exception, the copyright holders of exqalibur library give you
# permission to combine exqalibur with code included in the standard release of
# Perceval under the MIT license (or modified versions of such code). You may
# copy and distribute such a combined system following the terms of the MIT
# license for both exqalibur and Perceval. This exception for the usage of
# exqalibur is limited to the python bindings used by Perceval.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from perceval.utils.states import AnnotatedFockState, BasicState, FockState, NoisyFockState


def not_implemented_from_BasicState(ClassName):
res = [attr for attr in BasicState.__dict__ if not hasattr(ClassName, attr)]
res.remove("__weakref__")
return res


def test_FockStates_interface():
assert len( not_implemented_from_BasicState(FockState) ) == 0, "Some methods declared in BasicState are not implemented"

assert len( not_implemented_from_BasicState(NoisyFockState) ) == 0, "Some methods declared in BasicState are not implemented"

assert len( not_implemented_from_BasicState(AnnotatedFockState) ) == 0, "Some methods declared in BasicState are not implemented"
Loading