You're reading the documentation of the v0.7. For the latest released version, please have a look at v0.12.

Qiskit converter

Overview

Note

Qiskit is not listed as a Perceval dependency. Users wishing to use Qiskit shall install it by themselves.

Qiskit is an opensource quantum development library. A Qiskit QuantumCircuit can be converted to an equivalent Perceval Processor using QiskitConverter.

Minimal code:

>>> import qiskit
>>> from perceval.converters import QiskitConverter
>>> from perceval.components import catalog
>>> # Create a Quantum Circuit (the following is pure Qiskit syntax):
>>> qc = qiskit.QuantumCircuit(2)
>>> qc.h(0)
>>> qc.cx(0, 1)
>>> print(qc.draw())
     ┌───┐
q_0: ┤ H ├──■──
     └───┘┌─┴─┐
q_1: ─────┤ X ├
          └───┘
>>> # Then convert the Quantum Circuit with Perceval QiskitConvertor
>>> qiskit_convertor = QiskitConverter(catalog)
>>> perceval_processor = qiskit_convertor.convert(qc)

See also:

Qiskit tutorial

Qiskit conversion and decomposition example

Class reference

class perceval.converters.qiskit_converter.QiskitConverter(backend_name='SLOS', source=None, noise_model=None)

Qiskit quantum circuit to perceval processor converter.

Parameters:
  • backend_name (str) – backend name used in the converted processor (default SLOS)

  • source (Optional[Source]) – the source used as input for the converted processor (default perfect source).

convert(qc, use_postselection=True)

Convert a qiskit quantum circuit into a Processor.

Parameters:
  • qc (qiskit.QuantumCircuit) – quantum-based qiskit circuit

  • use_postselection (bool) – when True (default), uses optimized number of postprocessed CNOT and ‘Heralded CNOT’ gates. Otherwise, uses only heralded CNOT.

Return type:

Processor

Returns:

the converted processor