Skip to content
Snippets Groups Projects
Commit e9c00b96 authored by Bernabeu Lou's avatar Bernabeu Lou
Browse files

Added out method to special elements

parent 1ae27184
No related branches found
No related tags found
No related merge requests found
### ------ Special elements ------
class Source: class Source:
def __init__(self, initial_vector=np.array([0., 0.+0j])): def __init__(self, initial_vector=np.array([1., 0.+0j])): ## if no input state given, starts a |0>
self.photon = initial_vector self.photon = initial_vector
self.next = None self.next = None
def out(self, side):
return self.photon
class Screen: class Screen:
def __init__(self, previous=(None, None)): def __init__(self, previous=(None, None)):
self.previous = previous self.previous = previous
def show(self):
previous_component, previous_component_output_side = previous
print(previous_component.out(previous_component_output_side))
def out(self):
return previous_component.out(previous_component_output_site)
### ------ Classic Elements ------
class Element: class Element:
def __init__(self, previous): ## previous is either a single (previous_object, output) tuple, or a 2-dictionary of tuples def __init__(self, previous): ## previous is either a single (previous_object, output) tuple, or a 2-dictionary of tuples
self.previous = previous ## (as in {"left": (Object 1, "label of chosen output of object 1"), "right": (obj2, "label2")}) self.previous = previous ## (as in {"left": (Object 1, "label of chosen output of object 1"), "right": (obj2, "label2")})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment