cda-tum / mqt-qudits

A Framework For Mixed-Dimensional Qudit Quantum Computing
https://mqt.readthedocs.io/projects/qudits
MIT License
17 stars 4 forks source link

add dagger of a gate to the circuit #30

Closed danielmpla closed 4 months ago

danielmpla commented 4 months ago

Hi,

how would I add the dagger of a gate to the circuit?

For me it is not clear from the Tutorial. I assumed it would be e.g. circuit.csum([reg[i], reg[t]]).dag(), however in circ.instructions[0].__array__() the non-dagger version is added.

Regards, Daniel

KevinMTO commented 4 months ago

Hi Daniel, thanks for looking into it. The correct method is to use to_matrix(identity=[0,1,2]), a specific flag choice will give you a specific unitary.

__array__() is a magic function to generate the unitary, shouldn't be used. let me know if this helps :)