-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Superdense endcoding and decoding circuits to CircuitZoo (#34)
--------- Co-authored-by: Stefan Krastanov <[email protected]>
- Loading branch information
Showing
5 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using QuantumSavory | ||
using QuantumSavory.CircuitZoo: SDEncode, SDDecode | ||
using Test | ||
|
||
## Set up an entangled bell pair | ||
ra = Register(1) | ||
rb = Register(1) | ||
|
||
initialize!(ra[1], Z1) | ||
initialize!(rb[1], Z1) | ||
|
||
apply!(ra[1], H) | ||
apply!((ra[1], rb[1]), CNOT) | ||
|
||
# Random 2 bit classical message | ||
message = Tuple(rand(0:1, 2)) | ||
|
||
# Use the circuits to encode and decode the message | ||
SDEncode()(ra, message) | ||
rec = SDDecode()(ra, rb) | ||
|
||
@test message == rec |