Skip to content

Commit 9a6ae1e

Browse files
committed
update metadata
1 parent a723fd3 commit 9a6ae1e

1 file changed

Lines changed: 22 additions & 18 deletions

File tree

src/qclojure/examples/bell_state_circuit.clj

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
^{:kindly/hide-code true
22
:clay {:title "Bell State Circuit"
33
:quarto {:author :ludgersolbach
4-
:draft true
5-
:type :post
6-
:date "2025-10-10"}}}
4+
:draft false
5+
:type :post
6+
:date "2025-10-15"
7+
:tags [:qclojure :quantum-computing :quantum-circuit :simulation :bell-state]}}}
78
(ns qclojure.examples.bell-state-circuit
89
(:require
910
[scicloj.kindly.v4.kind :as kind]))
@@ -134,30 +135,27 @@ result
134135
(def ideal-simulator (ideal-sim/create-simulator))
135136

136137
;; We define some options for the execution, such as the results we want to obtain.
137-
;; In this case, we want to measure the qubits 100 times (shots).
138-
(def options {:result-specs {:measurements {:shots 100}}})
138+
;; In this case, we want to measure the qubits 10000 times, which is called the
139+
;; number of shots.
140+
(def options {:result-specs {:measurements {:shots 10000}}})
139141

140142
;; Now we can execute the circuit using the ideal simulator and the defined options.
141143
(def ideal-result
142144
(backend/execute-circuit ideal-simulator bell-state-circuit options))
143145

144-
;; The result is a map that contains the measurement results and other information
145-
;; about the execution.
146-
ideal-result
147-
148146
;; We can visualize the frequencies of the measurements obtained from the
149147
;; ideal simulator as a histogram.
150148
^kind/hiccup
151149
(viz/visualize-measurement-histogram :svg (get-in ideal-result [:results :measurement-results :frequencies]))
152150

153-
;; Now we you the hardware simulator to execute the Bell state circuit.
151+
;; Now we use the hardware simulator to execute the Bell state circuit.
154152
;; The hardware simulator simulates the quantum circuit with noise and errors
155153
;; that are present in real quantum hardware.
156154
(def hardware-simulator (hw-sim/create-hardware-simulator))
157155

158156
;; We can also select a specific quantum device to simulate. We choose the
159157
;; IBM Lagos quantum device for this example. The IBM Lagos is a 7-qubit quantum
160-
;; computer that is available on the IBM Quantum Experience platform.
158+
;; computer that is available on the IBM Quantum platform.
161159
(backend/select-device hardware-simulator :ibm-lagos)
162160

163161
;; We execute the circuit using the hardware simulator and the defined options.
@@ -173,14 +171,20 @@ hardware-result
173171
(viz/visualize-measurement-histogram :svg (get-in hardware-result [:results :measurement-results :frequencies]))
174172

175173
;; We results are probabilistic, so we may not get exactly the same results every time we
176-
;; execute the circuit. However, we should see that the results from the ideal simulator
177-
;; are closer to the expected Bell state results (|00⟩ and |11⟩ with similar counts) compared to the
178-
;; hardware simulator, which may show some deviations due to noise and errors.
179-
;; This demonstrates the impact of quantum noise and errors on the execution of quantum circuits
180-
;; on real quantum hardware.
174+
;; execute the circuit. Also the Bell state circuit is very simple, so the differences
175+
;; between the ideal and hardware simulation results may not be eminently visible.
176+
;; With a bit of 'luck', we would see a measurement of |01⟩ or |10⟩, because of a bit-flip
177+
;; caused by the noise of the hardware. However, with more complex circuits, the
178+
;; differences will show up on the hardware simulator and on real quantum hardware.
179+
;; We will explore more complex circuits in future examples.
181180
;;
182181
;; ## Conclusion
183182
;; In this example, we created a simple quantum circuit that generates a Bell state,
184183
;; visualized the circuit, and executed it using both an ideal simulator and a hardware
185-
;; simulator provided by QClojure. We observed the differences in the measurement results
186-
;; between the two simulators, highlighting the effects of noise and errors in quantum computing.
184+
;; simulator provided by QClojure. We also visualized the measurement results as histograms
185+
;; to compare the outcomes of the two simulations.
186+
;;
187+
;; This example demonstrates the basic concepts of quantum circuits, quantum gates,
188+
;; and quantum simulators using QClojure. You can build upon this foundation to explore
189+
;; more complex quantum algorithms and circuits. Please alos check out the tutorial in the
190+
;; [QClojure documentation](https://cljdoc.org/d/org.soulspace/qclojure).

0 commit comments

Comments
 (0)