I have a question concerning the placement of quantum circuits on Google devices. Consider the following code:
import cirq
q = [cirq.LineQubit(x) for x in range(5)]
circuit = cirq.Circuit(cirq.CNOT.on(q[0],q[3]), cirq.CNOT.on(q[1],q[4]))
line = cirq.google.line_on_device(cirq.google.Bristlecone, length=5)
circuit_opt = cirq.google.optimized_for_xmon(circuit=circuit, new_device=cirq.google.Bristlecone, qubit_map=lambda i: line[i.x])
simulator = cirq.Simulator()
result = simulator.run(circuit, repetitions=1024)
This ad comparable codes yields the error
ValueError: Non-local interaction: cirq.CZ.on(cirq.GridQubit(0, 5), cirq.GridQubit(1, 7)).
Does Cirq
provide a mechanism to automatically place (and route) a generic algorithm in the qubits 0..5 onto a concrete lattice structure?
Thanks in advance, Matthias