-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…325) Closes #322 BREAKING CHANGE: `qubit`s are now reset on allocation --------- Co-authored-by: Mark Koch <[email protected]>
- Loading branch information
Showing
3 changed files
with
46 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from guppylang.decorator import guppy | ||
from guppylang.module import GuppyModule | ||
from guppylang.prelude.quantum import qubit | ||
|
||
import guppylang.prelude.quantum as quantum | ||
from guppylang.prelude.quantum import cx, measure, dirty_qubit | ||
|
||
|
||
def test_dirty_qubit(validate): | ||
module = GuppyModule("test") | ||
module.load(quantum) | ||
|
||
@guppy(module) | ||
def test() -> tuple[bool, bool]: | ||
q1, q2 = qubit(), dirty_qubit() | ||
q1, q2 = cx(q1, q2) | ||
return (measure(q1), measure(q2)) | ||
|
||
validate(module.compile()) |