File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ import qiskit as q
2
+
3
+ """
4
+ Build a simple bare-minimum quantum
5
+ circuit that starts with a single qubit
6
+ (by default in state 0), runs the experiment
7
+ 1000 times, and finally prints the total
8
+ count of the states finally observed.
9
+ """
10
+
11
+ # Use Aer's qasm_simulator
12
+ simulator = q .Aer .get_backend ('qasm_simulator' )
13
+
14
+ # Create a Quantum Circuit acting on the q register
15
+ circuit = q .QuantumCircuit (1 , 1 )
16
+
17
+ # Map the quantum measurement to the classical bits
18
+ circuit .measure ([0 ], [0 ])
19
+
20
+ # Execute the circuit on the qasm simulator
21
+ job = q .execute (circuit , simulator , shots = 1000 )
22
+
23
+ # Grab results from the job
24
+ result = job .result ()
25
+
26
+ # Returns counts
27
+ counts = result .get_counts (circuit )
28
+ print ("\n Total count for varopis staes are:" , counts )
You can’t perform that action at this time.
0 commit comments