Commit fbe1ccf3 authored by Nguyen, Thien Minh's avatar Nguyen, Thien Minh
Browse files

Added test for exp_i_theta

Signed-off-by: Nguyen, Thien Minh's avatarThien Nguyen <>
parent 3854b4a4
......@@ -106,6 +106,19 @@ class TestSimpleKernelJIT(unittest.TestCase):
self.assertEqual(len(counts), 2)
self.assertTrue('00' in counts)
self.assertTrue('11' in counts)
def test_exp_i_theta(self):
def kernelExpVar(q : qreg, theta: float):
exponent_op = X(0) * Y(1) - Y(0) * X(1)
exp_i_theta(q, theta, exponent_op)
# Allocate 2 qubits
q = qalloc(2)
theta = 1.234
# Validate exp_i_theta expansion
comp = kernelExpVar.extract_composite(q, theta)
self.assertEqual(comp.nInstructions(), 14)
if __name__ == '__main__':
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment