summaryrefslogtreecommitdiff
path: root/misc
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
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')
-rw-r--r--misc/libquantum/distinfo3
-rw-r--r--misc/libquantum/patches/patch-aa36
2 files changed, 38 insertions, 1 deletions
diff --git a/misc/libquantum/distinfo b/misc/libquantum/distinfo
index 68d105bcfe8..ed8f59a7277 100644
--- a/misc/libquantum/distinfo
+++ b/misc/libquantum/distinfo
@@ -1,4 +1,5 @@
-$NetBSD: distinfo,v 1.1 2005/02/01 20:52:38 augustss Exp $
+$NetBSD: distinfo,v 1.2 2005/02/02 11:22:42 augustss Exp $
SHA1 (libquantum-0.2.4.tar.gz) = dbd76434b7d4026db96aedcd16ae4cd01fb341cd
Size (libquantum-0.2.4.tar.gz) = 211403 bytes
+SHA1 (patch-aa) = 734170cbc1a30815e89311f0a2d2df5a8d30b3d2
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;
+ }
+