This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Adjoint/Controlled DumpOperation output prints a state instead of a matrix #464
Open
Description
Describe the bug
Controlled or adjoint version of DumpOperation
prints a state that looks like a DumpMachine
output of a state which looks like the Choi–Jamiołkowski state for the given operation.
To Reproduce
Run the following code in a Q# standalone project:
@EntryPoint()
operation HelloQ () : Unit {
Message("Controlled DumpOperation with empty set of controls from a project");
Controlled DumpOperation(new Qubit[0], (1, ApplyToFirstQubitCA(X, _)));
}
This will yield
Controlled DumpOperation with empty set of controls from a project
# wave function for qubits with ids (least to most significant): 0;1
∣0❭: 0.000000 + 0.000000 i == [ 0.000000 ]
∣1❭: 0.707107 + 0.000000 i == *********** [ 0.500000 ] --- [ 0.00000 rad ]
∣2❭: 0.707107 + 0.000000 i == *********** [ 0.500000 ] --- [ 0.00000 rad ]
∣3❭: 0.000000 + 0.000000 i == [ 0.000000 ]
(Adjoint version will produce the same output.)
Expected behavior
I can imagine two reasonable behaviors: print nothing, or print a matrix similar to the non-controlled variant of DumpOperation
.
System information
- OS: Windows 10
- Version of affected package: 0.17.2105144881
Additional context
You can see the history of the bug discovery at microsoft/QuantumKatas#629. I isolated it and reproduced it in standalone Q# in addition to a regular Q# Jupyter Notebook cell, so I don't think the issue is in IQ#.