Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions guppylang/std/quantum/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ def t(q: qubit) -> None: ...
def s(q: qubit) -> None: ...


@guppy.hugr_op(quantum_op("V"))
@no_type_check
def v(q: qubit) -> None: ...


@guppy.hugr_op(quantum_op("X"))
@no_type_check
def x(q: qubit) -> None: ...
Expand All @@ -102,6 +107,11 @@ def tdg(q: qubit) -> None: ...
def sdg(q: qubit) -> None: ...


@guppy.hugr_op(quantum_op("Vdg"))
@no_type_check
def vdg(q: qubit) -> None: ...


@guppy.custom(RotationCompiler("Rz"))
@no_type_check
def rz(q: qubit, angle: angle) -> None: ...
Expand Down
14 changes: 14 additions & 0 deletions guppylang/std/quantum/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ def s(q: qubit @ owned) -> qubit:
return q


@guppy
@no_type_check
def v(q: qubit @ owned) -> qubit:
quantum.v(q)
return q


@guppy
@no_type_check
def x(q: qubit @ owned) -> qubit:
Expand Down Expand Up @@ -88,6 +95,13 @@ def sdg(q: qubit @ owned) -> qubit:
return q


@guppy
@no_type_check
def vdg(q: qubit @ owned) -> qubit:
quantum.vdg(q)
return q


@guppy
@no_type_check
def rz(q: qubit @ owned, angle: angle) -> qubit:
Expand Down
4 changes: 4 additions & 0 deletions guppylang/std/quantum_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
t,
tdg,
toffoli,
v,
vdg,
x,
y,
z,
Expand All @@ -29,11 +31,13 @@
"cy",
"t",
"s",
"v",
"x",
"y",
"z",
"tdg",
"sdg",
"vdg",
"rz",
"rx",
"ry",
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/test_quantum.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@
h,
t,
s,
v,
x,
y,
z,
tdg,
sdg,
vdg,
rx,
ry,
rz,
Expand Down Expand Up @@ -57,11 +59,13 @@ def test(q: qubit @ owned) -> qubit:
q = h(q)
q = t(q)
q = s(q)
q = v(q)
q = x(q)
q = y(q)
q = z(q)
q = tdg(q)
q = sdg(q)
q = vdg(q)
return q

validate(guppy.compile(test))
Expand Down
Loading