I would like to read the unitary matrix of a quantum circuit in ProjectQ. Is there any way to do it?
Most quantum circuit building softwares, including ProjectQ, do not have any convenience features that explicitly serve this purpose due to the potential overhead of calculating and storing the unitary as the number of qubits increases. The best solution is to create your own function that recovers the unitary. The general idea (software non-specific) is to:
- Create your quantum function
- Iterate through each operation and obtain the matrix representation
- Multiply each unitary to get the final unitary representation of the circuit