XanaduAI / blackbird

Blackbird is a quantum assembly language for continuous-variable quantum computation, that can be used to program Xanadu's quantum photonics hardware and Strawberry Fields simulator.
https://quantum-blackbird.readthedocs.io
Apache License 2.0
70 stars 26 forks source link

Remove the 'with' statement from the blackbird grammar, and replace it with a metadata block #6

Closed josh146 closed 5 years ago

josh146 commented 5 years ago

The new blackbird script for teleportation under this change:

# required metadata at the top of the file
name StateTeleportation
# required blackbird/cloud API version it targets
version 1.0
# optional 'target' specifies the device the blackbird
# program was compiled for, as well as any other device
# metadata/options
target gaussian (shots=1000)

# state to be teleported:
complex alpha = 1+0.5j
Coherent(alpha) | 0

# maximally entangled states
Squeezed(-4) | 1
Squeezed(4) | 2
BSgate(pi/4, 0) | (1, 2)

# Alice performs the joint measurement
# in the maximally entangled basis
int b = 5
BSgate(pi/4, b) | (0, 1)
MeasureX | 0
MeasureP | 1

# Bob conditionally displaces his mode
# based on Alice's measurement result
Xgate(sqrt(2)*q0) | 2
Zgate(sqrt(2)*q1) | 2

MeasureHeterodyne() | 2
codecov[bot] commented 5 years ago

Codecov Report

Merging #6 into master will increase coverage by 0.51%. The diff coverage is 85.54%.

@@            Coverage Diff             @@
##           master       #6      +/-   ##
==========================================
+ Coverage   93.21%   93.73%   +0.51%     
==========================================
  Files           7        7              
  Lines         752      814      +62     
==========================================
+ Hits          701      763      +62     
  Misses         51       51
Impacted Files Coverage Δ
blackbird_python/blackbird/error.py 20.31% <0%> (+5.05%) :arrow_up:
blackbird_python/blackbird/auxiliary.py 100% <100%> (ø) :arrow_up:
blackbird_python/blackbird/tests/test_auxiliary.py 100% <100%> (ø) :arrow_up:
blackbird_python/blackbird/tests/test_listener.py 100% <100%> (+0.62%) :arrow_up:
blackbird_python/blackbird/listener.py 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b92748a...0a853a9. Read the comment docs.

josh146 commented 5 years ago

As before, all files matching the pattern blackbird*.* are autogenerated and can be ignored