Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
sacpis committed Jul 18, 2024
2 parents 055d193 + b6c1f17 commit 026d8e6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
def do_something():
cudaq.reset_target()
yield
cudaq.__clearKernelRegistries()
## Ref: https://github.com/NVIDIA/cuda-quantum/issues/1954
# cudaq.__clearKernelRegistries()


def check_bell(entity):
Expand Down
14 changes: 0 additions & 14 deletions python/tests/display/CMakeLists.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,55 @@
import pytest


@cudaq.kernel
def bar(qvec: cudaq.qview):
# FIXME https://github.com/NVIDIA/cuda-quantum/issues/1734
# rx(np.e, qvec[0])
rx(2.71828182845904523536028, qvec[0])
ry(np.pi, qvec[1])
# FIXME https://github.com/NVIDIA/cuda-quantum/issues/1734
# cudaq.adjoint(rz, np.pi, qvec[2])
rz(-np.pi, qvec[2])
@pytest.fixture(autouse=True)
def do_something():
cudaq.reset_target()
yield
cudaq.__clearKernelRegistries()


@cudaq.kernel
def zaz(qub: cudaq.qubit):
sdg(qub)
def test_draw():
"""Test draw function, mainly copied from draw_tester.cpp"""

@cudaq.kernel
def bar(qvec: cudaq.qview):
# FIXME https://github.com/NVIDIA/cuda-quantum/issues/1734
# rx(np.e, qvec[0])
rx(2.71828182845904523536028, qvec[0])
ry(np.pi, qvec[1])
# FIXME https://github.com/NVIDIA/cuda-quantum/issues/1734
# cudaq.adjoint(rz, np.pi, qvec[2])
rz(-np.pi, qvec[2])

@cudaq.kernel
def kernel():
q = cudaq.qvector(4)
h(q)
x.ctrl(q[0], q[1])
y.ctrl(q[0], q[1], q[2])
y.ctrl(q[2], q[0], q[1])
y.ctrl(q[1], q[2], q[0])
z(q[2])
r1(3.14159, q[0])
tdg(q[1])
s(q[2])
swap(q[0], q[2])
swap(q[1], q[2])
swap(q[0], q[1])
swap(q[0], q[2])
swap(q[1], q[2])
swap.ctrl(q[3], q[0], q[1])
swap.ctrl(q[0], q[3], q[1], q[2])
swap.ctrl(q[1], q[0], q[3])
swap.ctrl(q[1], q[2], q[0], q[3])
bar(q)
cudaq.control(zaz, q[1], q[0])
cudaq.adjoint(bar, q)
@cudaq.kernel
def zaz(qub: cudaq.qubit):
sdg(qub)

@cudaq.kernel
def kernel():
q = cudaq.qvector(4)
h(q)
x.ctrl(q[0], q[1])
y.ctrl(q[0], q[1], q[2])
y.ctrl(q[2], q[0], q[1])
y.ctrl(q[1], q[2], q[0])
z(q[2])
r1(3.14159, q[0])
tdg(q[1])
s(q[2])
swap(q[0], q[2])
swap(q[1], q[2])
swap(q[0], q[1])
swap(q[0], q[2])
swap(q[1], q[2])
swap.ctrl(q[3], q[0], q[1])
swap.ctrl(q[0], q[3], q[1], q[2])
swap.ctrl(q[1], q[0], q[3])
swap.ctrl(q[1], q[2], q[0], q[3])
bar(q)
cudaq.control(zaz, q[1], q[0])
cudaq.adjoint(bar, q)

def test_draw():
"""Test draw function, mainly copied from draw_tester.cpp"""
# fmt: off
expected_str = R"""
╭───╮ ╭───╮╭───────────╮ ╭───────╮»
Expand Down Expand Up @@ -85,9 +90,6 @@ def test_draw():
produced_string = cudaq.draw(kernel)
assert expected_str == produced_string


def test_draw_latex():
"""Test draw function, mainly copied from draw_tester.cpp"""
# fmt: off
expected_str = R"""
\documentclass{minimal}
Expand Down

0 comments on commit 026d8e6

Please sign in to comment.