Skip to content

Commit 5c6cfe1

Browse files
README.md typo & manual QA (#13669) (#13674)
* Put yourself in `black`s shoes and look at the readme * Apply suggestions from code review Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com> --------- Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com> (cherry picked from commit 39db0c7) Co-authored-by: Julien Gacon <jules.gacon@googlemail.com>
1 parent c196408 commit 5c6cfe1

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

README.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -40,30 +40,30 @@ To install from source, follow the instructions in the [documentation](https://d
4040
Now that Qiskit is installed, it's time to begin working with Qiskit. The essential parts of a quantum program are:
4141
1. Define and build a quantum circuit that represents the quantum state
4242
2. Define the classical output by measurements or a set of observable operators
43-
3. Depending on the output, use the primitive function `sampler` to sample outcomes or the `estimator` to estimate values.
43+
3. Depending on the output, use the Sampler primitive to sample outcomes or the Estimator primitive to estimate expectation values.
4444

4545
Create an example quantum circuit using the `QuantumCircuit` class:
4646

4747
```python
4848
import numpy as np
4949
from qiskit import QuantumCircuit
5050

51-
# 1. A quantum circuit for preparing the quantum state |000> + i |111>
52-
qc_example = QuantumCircuit(3)
53-
qc_example.h(0) # generate superpostion
54-
qc_example.p(np.pi/2,0) # add quantum phase
55-
qc_example.cx(0,1) # 0th-qubit-Controlled-NOT gate on 1st qubit
56-
qc_example.cx(0,2) # 0th-qubit-Controlled-NOT gate on 2nd qubit
51+
# 1. A quantum circuit for preparing the quantum state |000> + i |111> / √2
52+
qc = QuantumCircuit(3)
53+
qc.h(0) # generate superposition
54+
qc.p(np.pi / 2, 0) # add quantum phase
55+
qc.cx(0, 1) # 0th-qubit-Controlled-NOT gate on 1st qubit
56+
qc.cx(0, 2) # 0th-qubit-Controlled-NOT gate on 2nd qubit
5757
```
5858

59-
This simple example makes an entangled state known as a [GHZ state](https://en.wikipedia.org/wiki/Greenberger%E2%80%93Horne%E2%80%93Zeilinger_state) $(|000\rangle + i|111\rangle)/\sqrt{2}$. It uses the standard quantum gates: Hadamard gate (`h`), Phase gate (`p`), and CNOT gate (`cx`).
59+
This simple example creates an entangled state known as a [GHZ state](https://en.wikipedia.org/wiki/Greenberger%E2%80%93Horne%E2%80%93Zeilinger_state) $(|000\rangle + i|111\rangle)/\sqrt{2}$. It uses the standard quantum gates: Hadamard gate (`h`), Phase gate (`p`), and CNOT gate (`cx`).
6060

61-
Once you've made your first quantum circuit, choose which primitive function you will use. Starting with `sampler`,
61+
Once you've made your first quantum circuit, choose which primitive you will use. Starting with the Sampler,
6262
we use `measure_all(inplace=False)` to get a copy of the circuit in which all the qubits are measured:
6363

6464
```python
6565
# 2. Add the classical output in the form of measurement of all qubits
66-
qc_measured = qc_example.measure_all(inplace=False)
66+
qc_measured = qc.measure_all(inplace=False)
6767

6868
# 3. Execute using the Sampler primitive
6969
from qiskit.primitives import StatevectorSampler
@@ -73,7 +73,7 @@ result = job.result()
7373
print(f" > Counts: {result[0].data["meas"].get_counts()}")
7474
```
7575
Running this will give an outcome similar to `{'000': 497, '111': 503}` which is `000` 50% of the time and `111` 50% of the time up to statistical fluctuations.
76-
To illustrate the power of Estimator, we now use the quantum information toolbox to create the operator $XXY+XYX+YXX-YYY$ and pass it to the `run()` function, along with our quantum circuit. Note the Estimator requires a circuit _**without**_ measurement, so we use the `qc_example` circuit we created earlier.
76+
To illustrate the power of the Estimator, we now use the quantum information toolbox to create the operator $XXY+XYX+YXX-YYY$ and pass it to the `run()` function, along with our quantum circuit. Note that the Estimator requires a circuit _**without**_ measurements, so we use the `qc` circuit we created earlier.
7777

7878
```python
7979
# 2. Define the observable to be measured
@@ -83,7 +83,7 @@ operator = SparsePauliOp.from_list([("XXY", 1), ("XYX", 1), ("YXX", 1), ("YYY",
8383
# 3. Execute using the Estimator primitive
8484
from qiskit.primitives import StatevectorEstimator
8585
estimator = StatevectorEstimator()
86-
job = estimator.run([(qc_example, operator)], precision=1e-3)
86+
job = estimator.run([(qc, operator)], precision=1e-3)
8787
result = job.result()
8888
print(f" > Expectation values: {result[0].data.evs}")
8989
```
@@ -96,17 +96,17 @@ The power of quantum computing cannot be simulated on classical computers and yo
9696
However, running a quantum circuit on hardware requires rewriting to the basis gates and connectivity of the quantum hardware.
9797
The tool that does this is the [transpiler](https://docs.quantum.ibm.com/api/qiskit/transpiler), and Qiskit includes transpiler passes for synthesis, optimization, mapping, and scheduling.
9898
However, it also includes a default compiler, which works very well in most examples.
99-
The following code will map the example circuit to the `basis_gates = ['cz', 'sx', 'rz']` and a linear chain of qubits $0 \rightarrow 1 \rightarrow 2$ with the `coupling_map =[[0, 1], [1, 2]]`.
99+
The following code will map the example circuit to the `basis_gates = ["cz", "sx", "rz"]` and a linear chain of qubits $0 \rightarrow 1 \rightarrow 2$ with the `coupling_map = [[0, 1], [1, 2]]`.
100100

101101
```python
102102
from qiskit import transpile
103-
qc_transpiled = transpile(qc_example, basis_gates = ['cz', 'sx', 'rz'], coupling_map =[[0, 1], [1, 2]] , optimization_level=3)
103+
qc_transpiled = transpile(qc, basis_gates=["cz", "sx", "rz"], coupling_map=[[0, 1], [1, 2]], optimization_level=3)
104104
```
105105

106106
### Executing your code on real quantum hardware
107107

108108
Qiskit provides an abstraction layer that lets users run quantum circuits on hardware from any vendor that provides a compatible interface.
109-
The best way to use Qiskit is with a runtime environment that provides optimized implementations of `sampler` and `estimator` for a given hardware platform. This runtime may involve using pre- and post-processing, such as optimized transpiler passes with error suppression, error mitigation, and, eventually, error correction built in. A runtime implements `qiskit.primitives.BaseSamplerV2` and `qiskit.primitives.BaseEstimatorV2` interfaces. For example,
109+
The best way to use Qiskit is with a runtime environment that provides optimized implementations of Sampler and Estimator for a given hardware platform. This runtime may involve using pre- and post-processing, such as optimized transpiler passes with error suppression, error mitigation, and, eventually, error correction built in. A runtime implements `qiskit.primitives.BaseSamplerV2` and `qiskit.primitives.BaseEstimatorV2` interfaces. For example,
110110
some packages that provide implementations of a runtime primitive implementation are:
111111

112112
* https://github.com/Qiskit/qiskit-ibm-runtime

0 commit comments

Comments
 (0)