Ver código fonte

Fixed bugs in measurement code

Adam Kelly 5 anos atrás
pai
commit
48c15ae76a
2 arquivos alterados com 4 adições e 3 exclusões
  1. 1 1
      examples/bell_state.py
  2. 3 2
      qcgpu/backend.py

+ 1 - 1
examples/bell_state.py

@@ -15,7 +15,7 @@ def bell_state():
 
     print("Creating Bell State")
 
-    state = qcgpu.state(2)
+    state = qcgpu.State(2)
 
     state.h(0)
     state.cx(0, 1)

+ 3 - 2
qcgpu/backend.py

@@ -81,7 +81,8 @@ class Backend:
         # is attrocious
 
         probabilities = self.probabilities()
-
+        # print(probabilities)
+        # print(np.sum(self.amplitudes()))
         choices = np.random.choice(
             np.arange(0, 2**self.num_qubits), 
             samples, 
@@ -170,7 +171,7 @@ class Backend:
 
         self.program.calculate_probabilities(
             self.queue,
-            self.buffer.shape,
+            out.shape,
             None,
             self.buffer.data,
             out.data