MicroQiskit Library Reference¶
A version of Qiskit made for microcontrollers and for educational purposes. See https://qiskit.org for more on Qiskit.
-
simulate(qc,shots=1024,get='counts',noise_model=[]): Runs the quantum circuit
qc. Results are given from multiple runs, the number of which is specified byshots. The type of output is specified byget, which can be set to'counts','memory','statevector'orprobabilities_dict. The former two require the circuit to contain measurement gates, whereas the latter two do not and will ignore any meaasure gates present.This is the MicroQiskit equivalent of the
executefunction in Qiskit, as well as theStatevectorandDensityMatrixclasses, all of which can be used to run circuits. The form of the outputs have the following differences.For a
'statevector'output: Complex numbers are specified as a two element list instead of standard Python complex number notation. So a numbera+bjwill become[a,b].A limited capacity for adding noise is implemented in MicroQiskit. Specifically, bit flip errors can be added at the very end of the circuit to all qubits. To apply this, supply a list of the desired error probabilities for each qubit as the
noise_modelargument.
-
class
microqiskit.QuantumCircuit(num_qubits, num_clbits=0)¶ Contains a quantum circuit, which is essentially a list of quantum gates that are applied to a register of qubits. At the end, a binary output is recorded on a register of bits.
This is the MicroQiskit version of the identically named class in Qiskit.
-
classmethod
initialize(ket)¶ Initializes a circuit with the state described by the statevector
ket.
-
classmethod
x(qubit)¶ Adds an
xgate to the circuit on the given qubit.
-
classmethod
rx(theta, qubit)¶ Adds rotation around the x axis to the circuit on the given qubit. The angle is given by
theta.
-
classmethod
ry(theta, qubit)¶ Adds rotation around the y axis to the circuit on the given qubit. The angle is given by
theta.
-
classmethod
rz(theta, qubit)¶ Adds rotation around the z axis to the circuit on the given qubit. The angle is given by
theta.
-
classmethod
h(qubit)¶ Adds an
hgate to the circuit on the given qubit.
-
classmethod
cx(control, target)¶ Adds a
cxgate to the circuit for the given control and target qubits.
-
classmethod
measure(qubit, bit)¶ Adds a measure gate, which extracts a bit of output from the given qubit.
-
num_qubits¶ Returns the number of qubits in the circuit.
-
num_clbits¶ Returns the number of classical bits in the circuit.
-
classmethod