Commit 070bb988 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

adding qsearch example

parent 0f00e719
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
from qcor import *

@qjit
def ccnot(q : qreg):
    # create 111
    for i in range(q.size()):
        X(q[i])
            
    with decompose(q, qsearch) as ccnot:
        ccnot = np.eye(8)
        ccnot[6,6] = 0.0
        ccnot[7,7] = 0.0
        ccnot[6,7] = 1.0
        ccnot[7,6] = 1.0
    
    # CCNOT should produce 110 (lsb)
    for i in range(q.size()):
        Measure(q[i])

q = qalloc(3)
ccnot(q)
counts = q.counts()
print(counts)