Closed EllaCrane closed 2 years ago
Should your code be this, instead? Is the cutoff passed into stateread correct?
num_qumodes=2
qubits_per_mode=3
qmr = c2qa.QumodeRegister(num_qumodes=num_qumodes, num_qubits_per_qumode=qubits_per_mode, name="qmr")
circuit = c2qa.CVCircuit(qmr)
circuit.cv_initialize(2, qmr[0])
circuit.cv_initialize(0, qmr[1])
state, result = c2qa.util.simulate(circuit)
occs = c2qa.util.stateread(state, numberofqubits=0, numberofmodes=num_qumodes, cutoff=circuit.cutoff, verbose=True)
My output with this is:
qumodes: 02 qubits: with amplitude: 1.000 + i0.000
occupation modes [0.0, 2.0]
occupation qubits []
YES!! Haha thank you Tim!
`qubits_per_mode=3
qmr = c2qa.QumodeRegister(num_qumodes=2, num_qubits_per_qumode=qubits_per_mode, name="qmr")
circuit = c2qa.CVCircuit(qmr)
circuit.cv_initialize(2, qmr[0]) circuit.cv_initialize(0, qmr[1]) stateop, result = c2qa.util.simulate(circuit) occs = util.stateread(stateop, 0, 2, 4, verbose=True)`