unitary icon indicating copy to clipboard operation
unitary copied to clipboard

SparseSimulator does not support qudit operations

Open smitsanghavi opened this issue 3 years ago • 1 comments

SparseSimulator code assumes a system of qubits only and does not support general qudits.

Running the simple Circuit below gives a ValueError size 2 is different from 3.

qudit = cirq.NamedQid("a", 3)
circuit = cirq.Circuit(qudit_gates.QuditXGate(3).on(qudit), cirq.measure(qudit))
SparseSimulator().run(circuit).measurements

smitsanghavi avatar Jan 16 '23 02:01 smitsanghavi

https://github.com/quantumlib/unitary/pull/76 partially gets around this since there are no qudits in the circuit after it gets compiled to qubits, so SparseSimulator can be used on a qudit-based QuantumWorld that has compile_to_qubits=True. We still need to fix the SparseSimulator for when compile_to_qubits=False (default)

smitsanghavi avatar Jan 18 '23 00:01 smitsanghavi