What Are Common Qiskit Commands?
Programming a Quantum Computer
Qiskit Import
- import qiskit
- import random
- import matplotlib.pyplot as plt
- from sklearn.metrics import precision_score
- from sklearn.metrics import recall_score
- from sklearn.metrics import confusion_matrix
- from functools import reduce
- from math import sqrt, pi, cos, sin, exp, asin, ceil
- from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
- from qiskit import execute, Aer
- from qiskit.visualization import plot_histogram, plot_bloch_multivector, plot_state_qsphere
Qiskit Commands
- execute(qc, backend) / execute(qc, backend, shots = 1000)
Qiskit Objects
- Aer()
- job
- result
- QuantumCircuit(qr, cr)
- ClassicalRegister(4, name='cr')
- QuantumRegister(4, name='qubit')
Qiskit Functions / Methods
- .cry(theta, control_qubit, target_qubit)
- .cx(control_qubit, target_qubit)
- .ccx(control_qubit1, control_qubit2, target_qubit)
- .draw('text') / .draw('mpl') /
- .get_backend('statevector_simulator')
- aer_simulator, aer_simulator_statevector, aer_simulator_density_matrix, aer_simulator_stabilizer, aer_simulator_matrix_product_state, aer_simulator_extended_stabilizer, aer_simulator_unitary, aer_simulator_superop
qasm_simulator, statevector_simulator, unitary_simulator, pulse_simulator
- .get_counts(): returns a dictionary that has the counts for each qubit
- .get_unitary()
- .h(qubit) / .h([0, 1, 2, 3])
- .initialize()
- .measure_all() / .measure(qr[1], cr[1])
- .result()
- .ry(theta, qubit):
- .x(0)
Qiskit Information
- qiskit._ _qiskit_version_ _
Qiskit Visualization