VirtualQiskitBackend#

class VirtualQiskitBackend(backend=None, port=9011)[source]#

This class instantiates a VirtualBackend using a Qiskit backend. This allows easy access to Qiskit backends through the qrisp interface.

Parameters
backendQiskit backend object, optional

A Qiskit backend object, which runs QuantumCircuits. The default is Aer.get_backend(‘qasm_simulator’).

portint, optional

The port to listen. The default is 8079.

Examples

We evaluate a QuantumFloat multiplication on the QASM-simulator.

>>> from qrisp import QuantumFloat
>>> from qrisp.interface import VirtualQiskitBackend
>>> from qiskit import Aer
>>> example_backend = VirtualQiskitBackend(backend = Aer.get_backend('qasm_simulator'))
>>> qf = QuantumFloat(4)
>>> qf[:] = 3
>>> res = qf*qf
>>> res.get_measurement(backend = example_backend)
{9: 1.0}