It's been a while since I got into QCL but I ran into some difficulties by trying to figure out the functioning of measure regX
or measure regX,m
.
What does this do on the quantum registers? And the m
integer?
In Bernhard's Ömer PhD thesis Structured Quantum Programming, in Appendix A.3.1.4 clearly states that
measure regX
-- performs measurement on register regX
and
measure regX,m
-- performs measurement on register regX
and writes the result of the measurement to classical variable m
.
If you do not understand the model behind quantum measurement it is difficult to fully understand what QCL does. But roughly speaking measurement chooses randomly one of the basis quantum states which spans the quantum superposition in which regX
is and writes it to variable m
.