Quantum Chess: Decomposition into CZ gates
Quantum chess curreently decomposes moves into circuits containing square root of iSWAP gates (ie. ISWAP ** 0.5). It would also be good to be able to decompose these operations into CZ-based gates to support future processors.
In particular, the methods in the following files need to be able to support outputting circuits using CZ:
https://github.com/quantumlib/ReCirq/blob/master/recirq/quantum_chess/quantum_moves.py https://github.com/quantumlib/ReCirq/blob/master/recirq/quantum_chess/controlled_iswap.py
This would be a good project for a 20% contributor interested in learning about quantum computing.
This was some code that we used to run it on a CZ grid for one time. We might just want something more user-friendly.
import cirq import cirq_google as cg import unitary.quantum_chess.ascii_board as ab import unitary.quantum_chess.move as m import unitary.quantum_chess.quantum_board as qb import unitary.quantum_chess.circuit_transformer as ct
sampler = cirq.Simulator()
gs = cirq.CZTargetGateset() mapper=ct.ConnectivityHeuristicCircuitTransformer(device) transformer = lambda circuit: mapper(cirq.optimize_for_target_gateset(circuit, gateset=gs)) board=qb.CirqBoard( init_basis_state=0, sampler=sampler, device=device, transformer=transformer ) example_move=m.Move.from_string("g1^f3h3:SPLIT_JUMP:BASIC") b = ab.AsciiBoard(board=board) b.reset() b.apply(example_move) print(b)