From 36435e941c2ffbc5b95afb9ddcd313e00c14d9bb Mon Sep 17 00:00:00 2001 From: Jay Gambetta Date: Sun, 18 Aug 2019 08:50:54 -0400 Subject: [PATCH] Update getting_started.rst (#418) * Update getting_started.rst * Update getting_started.rst * Update getting_started.rst * Update getting_started.rst * Update getting_started.rst * grr limiting on the web editor is not fun * Update getting_started.rst * minor code styling --- docs/getting_started.rst | 41 ++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index c7dd0ab945c2..59534841e7d4 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -27,16 +27,16 @@ subsequent sections: simulator = Aer.get_backend('qasm_simulator') # Create a Quantum Circuit acting on the q register - circuit = QuantumCircuit(2,2) + circuit = QuantumCircuit(2, 2) # Add a H gate on qubit 0 circuit.h(0) # Add a CX (CNOT) gate on control qubit 0 and target qubit 1 - circuit.cx(0,1) + circuit.cx(0, 1) # Map the quantum measurement to the classical bits - circuit.measure([0,1],[0,1]) + circuit.measure([0,1], [0,1]) # Execute the circuit on the qasm simulator job = execute(circuit, simulator, shots=1000) @@ -49,7 +49,7 @@ subsequent sections: print("\nTotal count for 00 and 11 are:",counts) # Draw the circuit - circuit.draw(output='mpl') + circuit.draw() .. code-block:: text @@ -58,6 +58,23 @@ subsequent sections: .. image:: /images/figures/getting_started_1_1.png :alt: Quantum Circuit with an H gate and controlled nots. +.. note:: + + The default backend for qiskit.visualization.circuit_drawer()/QuantumCircuit.draw() is the text backend. + However, depending on your local environment you may want to change these defaults to something better + suited for your use case. This is done with the user config file. By default the user config file + should be located in ~/.qiskit/settings.conf and is a .ini file. + + For example, a settings.conf file for setting a Matplotlib drawer is: + + .. code-block:: text + + [default] + circuit_drawer = mpl + + You can use any of the valid circuit drawer backends as the value for this config, this includes + text, mpl, latex, and latex_source. + .. code-block:: python # Plot a histogram @@ -115,7 +132,7 @@ Consider the next line of code .. code-block:: python - circuit = QuantumCircuit(2,2) + circuit = QuantumCircuit(2, 2) Here, you are initializing with 2 qubits in the zero state; with 2 classical bits set to zero; and ``circuit`` is the quantum circuit. @@ -138,7 +155,7 @@ Consider the following three lines of code: circuit.h(0) circuit.cx(0, 1) - circuit.measure([0,1],[0,1]) + circuit.measure([0,1], [0,1]) The gates are added to the circuit one-by-one to form the Bell state @@ -148,7 +165,7 @@ The code above applies the following gates: - ``QuantumCircuit.h(0)``: A Hadamard gate :math:`H` on qubit 0, which puts it into a **superposition state**. -- ``QuantumCircuit.cx(0,1)``: A controlled-Not operation +- ``QuantumCircuit.cx(0, 1)``: A controlled-Not operation (:math:`C_{X}`) on control qubit 0 and target qubit 1, putting the qubits in an **entangled state**. - ``QuantumCircuit.measure([0,1], [0,1])``: if you pass @@ -167,7 +184,7 @@ textbooks and research articles. .. code-block:: python - circuit.draw(output='mpl') + circuit.draw() .. image:: images/figures/getting_started_1_1.png :alt: Quantum circuit to make a Bell state. @@ -242,9 +259,9 @@ Next Steps Now that you have learnt the basics, consider these learning resources: -- `Notebook tutorials `__ -- `Video tutorials `__ -- `Interactive tutorials in IBM Q Experience `__ -- :ref:`Frequently Asked Questions ` +- `Notebook tutorials `__ +- `Video tutorials `__ +- :ref:` API References ` +