MicroQiskit Library Reference
A minimal quantum SDK for Lua.
- simulate(qc,get,counts):
This is the MicroQiskit equivalent of the
executefunction in Qiskit.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'or'statevector'. If noshotsis supplied, a default value of 1024 is used.Note that, for a
'statevector'output, complex numbers are specified as a two element table instead of Python complex number notation. So a numbera+bjwill become{a,b}.Note that the
'counts'output is generated by a sampling process, which can be too slow for some use cases. This can be avoided by using'expected_counts', which instead returns the expectation value of the counts.
- class QuantumCircuit
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 set_registers(num_qubits, num_bits)
Initializes a circuit with
num_qubitsqubits andnum_bitsoutput bits. The latter need not be supplied in the case of a'statevector'output.Note that, in the full version of Qiskit, this information is supplied when initializing
QuantumCircuit.
- 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 t(qubit)
Adds aa
tgate 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 crx(control, target)
Adds a
crxgate to the circuit for the given control and target qubits. The angle is given bytheta.
- classmethod swap(control, target)
Adds a
swapgate to the circuit for the given pair of qubits.
- classmethod measure(qubit, bit)
Adds a measure gate, which extracts a bit of output from the given qubit. Note that measurements are always applied at the end, irrespective of where they are placed in the circuit.
- classmethod measure_all()
Adds a measure gate for each qubit, reading out to a bit with the same index. If no classical register is present, one is formed of the required size.
- num_qubits
Returns the number of qubits in the circuit.
- num_clbits
Returns the number of classical bits in the circuit.