Skip to content

Commit

Permalink
add measures
Browse files Browse the repository at this point in the history
  • Loading branch information
ss2165 committed Oct 18, 2024
1 parent 3d29984 commit 9b9c6fa
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion guppylang/prelude/quantum.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,20 @@ def cz(self: "qubit", target: "qubit") -> None:
def cx(self: "qubit", target: "qubit") -> None:
cx(self, target)

@guppy
@no_type_check
def measure(self: "qubit" @owned) -> bool:
return measure(self)

@guppy
@no_type_check
def measure_return(self: "qubit") -> bool:
return measure_return(self)

@guppy
@no_type_check
def measure_reset(self: "qubit") -> bool:
res = measure_return(self)
res = self.measure_return()
if res:
self.x()
return res
Expand Down

0 comments on commit 9b9c6fa

Please sign in to comment.