This fixes a bug in the way the wave function was produced for calls to DumpRegister, specifically because the calculation needs to use the sum of the squares of the normalization of each amplitude rather than just the sum of the normalization value itself. This ensures the amplitudes output by DumpRegister correctly sum to 1.
This fixes a bug in the way the wave function was produced for calls to
DumpRegister
, specifically because the calculation needs to use the sum of the squares of the normalization of each amplitude rather than just the sum of the normalization value itself. This ensures the amplitudes output byDumpRegister
correctly sum to 1.Output before fix:![image](https://github.com/microsoft/qsharp/assets/10567287/8d598a7a-84af-4750-b3d6-4cd2767b222f)
Output after fix:![image](https://github.com/microsoft/qsharp/assets/10567287/db4bebb8-5b49-44fb-b211-90131fdf9e41)