Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Photonics tool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bernabeu Lou
Photonics tool
Commits
e9c00b96
Commit
e9c00b96
authored
4 years ago
by
Bernabeu Lou
Browse files
Options
Downloads
Patches
Plain Diff
Added out method to special elements
parent
1ae27184
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
elements/main.py
+14
-1
14 additions, 1 deletion
elements/main.py
with
14 additions
and
1 deletion
elements/main.py
+
14
−
1
View file @
e9c00b96
### ------ 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")})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment