pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/misc/libquantum Fix a bug in quantum_measure() that re...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d5de67145a2a
branches:  trunk
changeset: 488492:d5de67145a2a
user:      augustss <augustss%pkgsrc.org@localhost>
date:      Wed Feb 02 11:22:42 2005 +0000

description:
Fix a bug in quantum_measure() that returns the wrong state when measuring
a quantum register.

diffstat:

 misc/libquantum/distinfo         |   3 ++-
 misc/libquantum/patches/patch-aa |  36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletions(-)

diffs (50 lines):

diff -r 0c3b41301993 -r d5de67145a2a misc/libquantum/distinfo
--- a/misc/libquantum/distinfo  Wed Feb 02 10:33:01 2005 +0000
+++ b/misc/libquantum/distinfo  Wed Feb 02 11:22:42 2005 +0000
@@ -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 -r 0c3b41301993 -r d5de67145a2a misc/libquantum/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libquantum/patches/patch-aa  Wed Feb 02 11:22:42 2005 +0000
@@ -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;
+      }
+  



Home | Main Index | Thread Index | Old Index