Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add measure_array and discard_array quantum function #710

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
use for loop
Co-authored-by: Mark Koch <48097969+mark-koch@users.noreply.github.com>
  • Loading branch information
ss2165 and mark-koch committed Dec 12, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 0c73b045dde07dec8e2e66ee17fc191e329a70b9
4 changes: 3 additions & 1 deletion guppylang/std/quantum.py
Original file line number Diff line number Diff line change
@@ -155,8 +155,10 @@ def measure_array(qubits: array[qubit, N] @ owned) -> array[bool, N]:
"""Measure an array of qubits, returning an array of bools."""
return array(measure(q) for q in qubits)


@guppy
@no_type_check
def discard_array(qubits: array[qubit, N] @ owned) -> None:
"""Discard an array of qubits."""
_ = array(discard(q) for q in qubits)
for q in qubits:
discard(q)
Loading