ソースを参照

Fixed bugs in measurement code

Adam Kelly 5 年 前
コミット
48c15ae76a
2 ファイル変更4 行追加3 行削除
  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