diff --git a/elements/main.py b/elements/main.py index 60722db37732ad6d5b35865efea4f5906e1fc57b..03a98168c6b2b9634757a19428a1681b28ec55f4 100644 --- a/elements/main.py +++ b/elements/main.py @@ -1,14 +1,27 @@ +### ------ Special elements ------ 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.next = None + def out(self, side): + return self.photon + class Screen: def __init__(self, previous=(None, None)): 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: 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")})