C2QA / bosonic-qiskit

Extension of Qiskit to support hybrid boson-qubit simulations for the NQI C2QA effort.
BSD 2-Clause "Simplified" License
51 stars 14 forks source link

Gates on qumodes with more than 2 qubits per mode #49

Closed EllaCrane closed 2 years ago

EllaCrane commented 2 years ago

Choosing numberofqubitspermode to be 2 here works fine, but setting it to 3 throws an error.

numberofmodes=2
numberofqubitspermode=3
qmr = c2qa.QumodeRegister(num_qumodes=numberofmodes, num_qubits_per_qumode=numberofqubitspermode)
circuit = c2qa.CVCircuit(qmr)
circuit.cv_bs(-1j, qmr[0], qmr[1])

Error: CircuitError: 'The amount of qubit(6)/clbit(0) arguments does not match the gate expectation (8).'

EllaCrane commented 2 years ago

Resolve by adding the value to num_qubits e.g. num_qubits=len(qumode_a) + 1` in the definition of ParameterizedUnitaryGate