QiskitRuntimeBackend#

class QiskitRuntimeBackend(backend=None, port=8079, token='')[source]#

This class instantiates a VirtualBackend using a Qiskit Runtime backend. This allows easy access to Qiskit Runtime backends through the qrisp interface. It is imporant to close the session after the execution of the algorithm (as reported in the example below).

Parameters:
backendstr, optional

A string associated to the name of a Qiskit Runtime Backend. The default one is the “ibmq_qasm_simulator”, but it also possible to provide other ones like “simulator_statevector” or real backends from the Qiskit Runtime.

portint, optional

The port to listen. The default is 8079.

tokenstr

The token is necessary to create correctly the Qiskit Runtime service and be able to run algorithms on their backends.

Examples

>>> from qrisp import QuantumFloat
>>> from qrisp.interface import QiskitRuntimeBackend
>>> example_backend = QiskitRuntimeBackend(backend="simulator_statevector",token='YOUR_TOKEN')
>>> qf = QuantumFloat(4)
>>> qf[:] = 3
>>> res = qf*qf
>>> result=res.get_measurement(backend = example_backend)
>>> print(results)
>>> example_backend.close_session()
{9: 1.0}