I've been trying to decompose the ProjectQ objects and I could manage to decompose non-controlled gates and daggered gates. But I noticed that the object of a controlled version of a gate is the exact same as the object of that gate.
The code generating these objects:
eng = MainEngine()
q = eng.allocate_qubit()
p = eng.allocate_qubit()
c = eng.allocate_qubit()
X | q
CNOT | (p,q)
This is the XGate object
{'_control_qubits': [],
'_engine': <__main__.MainEngine object at 0x7fc323e4d198>,
'_qubits': ([<projectq.types._qubit.WeakQubitRef object at 0x7fc30b0a3ef0>],),
'gate': <projectq.ops._gates.XGate object at 0x7fc316778048>,
'tags': []}
And this is the CNOT gate, which is the same as ControlledGate(XGate)
{'_control_qubits': [],
'_engine': <__main__.MainEngine object at 0x7fc323e4d198>,
'_qubits': ([<projectq.types._qubit.WeakQubitRef object at 0x7fc30b0b1080>],),
'gate': <projectq.ops._gates.XGate object at 0x7fc316778048>,
'tags': []}
Both have no control qubits and it seems like the control gates lost the control qubit.
Any idea on where the control qubit is stored?