Loading python/examples/README.md +1 −1 Original line number Diff line number Diff line Loading @@ -30,4 +30,4 @@ Employing the QCOR just-in-time (qjit) compilation features, we can wrap QCOR in `vqe_ftqc.py` example demonstrating VQE algorithm using the ftqc runtime. `unitary.py` example demonstrating circuit synthesis language extension. No newline at end of file `unitary.py`, `qcor_qsearch.py` and `qcor_qfactor.py`: examples demonstrating circuit synthesis language extension. No newline at end of file python/examples/qcor_qfactor.py 0 → 100644 +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]) # decompose with qfactor with decompose(q, qfactor) 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) Loading
python/examples/README.md +1 −1 Original line number Diff line number Diff line Loading @@ -30,4 +30,4 @@ Employing the QCOR just-in-time (qjit) compilation features, we can wrap QCOR in `vqe_ftqc.py` example demonstrating VQE algorithm using the ftqc runtime. `unitary.py` example demonstrating circuit synthesis language extension. No newline at end of file `unitary.py`, `qcor_qsearch.py` and `qcor_qfactor.py`: examples demonstrating circuit synthesis language extension. No newline at end of file
python/examples/qcor_qfactor.py 0 → 100644 +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]) # decompose with qfactor with decompose(q, qfactor) 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)