quilc
quilc copied to clipboard
Parametric compilation doesn't use 2Q optimality results
We recently (#498) introduced a parametric compilation feature for gates described by time-independent Hamiltonians. The technique implemented there works for any number of qubits, but it has no guarantee on optimality of circuit depth. Indeed, in the two-qubit case of XX + YY it emits a circuit with 6 CZs, but a 2 CZ circuit exists:
RZ(3*pi/4) 0
RX(-pi/2) 0
RZ(-3*pi/4) 1
RX(pi/2) 1
CZ 0 1
RZ(-pi/2) 0
RX(pi/2) 0
RZ(%alpha) 0
RX(-pi/2) 0
RZ(-pi/2) 1
RX(pi/2) 1
RZ(%alpha) 1
RX(-pi/2) 1
CZ 0 1
RZ(-pi/2) 0
RX(-pi/2) 0
RZ(pi/4) 0
RZ(-pi/2) 1
RX(pi/2) 1
RZ(-pi/4) 1
There is room for an extension of the CZ-targeting techniques found in src/compilers/approx.lisp to give improved circuits in the 2Q case.
Note: I don't think this can be trampolined to from the n-qubit case.