summaryrefslogtreecommitdiff
path: root/misc/libquantum/patches
diff options
context:
space:
mode:
authoraugustss <augustss@pkgsrc.org>2005-02-02 11:22:42 +0000
committeraugustss <augustss@pkgsrc.org>2005-02-02 11:22:42 +0000
commitb750a675b29defac3b8de7c34623e8bcd9e2c83f (patch)
tree6b1df9a2a435a21dfa8fb2395363800f06fe7f70 /misc/libquantum/patches
parenta6f8c45bfc8152da7d516442cdc147108ffb4f58 (diff)
downloadpkgsrc-b750a675b29defac3b8de7c34623e8bcd9e2c83f.tar.gz
Fix a bug in quantum_measure() that returns the wrong state when measuring
a quantum register.
Diffstat (limited to 'misc/libquantum/patches')
-rw-r--r--misc/libquantum/patches/patch-aa36
1 files changed, 36 insertions, 0 deletions
diff --git a/misc/libquantum/patches/patch-aa b/misc/libquantum/patches/patch-aa
new file mode 100644
index 00000000000..e6ef630fead
--- /dev/null
+++ b/misc/libquantum/patches/patch-aa
@@ -0,0 +1,36 @@
+*** measure.c.old Tue Jan 11 22:12:21 2005
+--- measure.c Wed Feb 2 12:17:54 2005
+***************
+*** 39,45 ****
+ double
+ quantum_frand()
+ {
+! return (double) rand() / RAND_MAX;
+ }
+
+ /* Measure the contents of a quantum register */
+--- 39,45 ----
+ double
+ quantum_frand()
+ {
+! return (double) random() / RAND_MAX;
+ }
+
+ /* Measure the contents of a quantum register */
+***************
+*** 64,70 ****
+ result. Otherwise, continue with the next base state. */
+
+ r -= quantum_prob_inline(reg.node[i].amplitude);
+! if(quantum_prob_inline(reg.node[i].amplitude) >= r)
+ return reg.node[i].state;
+ }
+
+--- 64,70 ----
+ result. Otherwise, continue with the next base state. */
+
+ r -= quantum_prob_inline(reg.node[i].amplitude);
+! if(0 >= r)
+ return reg.node[i].state;
+ }
+