qat.qiskit.converters.QiskitToQaptiva

class qat.qiskit.converters.QiskitToQaptiva(gates_dict: dict | None = None)

Qiskit to Qaptiva converter, takes a Qiskit QuantumCircuit and converts it into a Qaptiva circuit, with all the required parameters and data

Tis translator can translate a circuit composed of known gates, but additional gate translation can be passed in argument:

from qat.lang import AbstractGate

FOO_GATE = AbstractGate(Foo, [], arity=1)

# "foo" gate will be translated into FOO_GATE in Qaptiva
translator = QiskitToQaptiva({"foo": FOO_GATE})
Parameters:

gates_dict (dict, optional) – custom gate translation

to_circ(quantum_circuit: qiskit.circuit.QuantumCircuit, sep_measures: bool = False, limit: int = 2, **kwargs)

Converts a Qiskit circuit into a Qaptiva circuit. If a gate is defined by a circuit implementation, this gate can be replaced by its equivalent circuit in the result returned by this method (this technique is called inlining)

Parameters:
  • qiskit_circuit – The Qiskit circuit to convert

  • sep_measures (bool, optional) –

    Separates measures from the circuit:

    • if set to True, measures won’t be included in the resulting circuit. This method will then return a tuple composed of the circuit with no measument, and the list of measured qubits.

    • if set to False, measures will be converted normally (Default, set to False)

  • limit (int, optional) – inlining recursion limit

  • **kwargs – Additional parameters passed to the method to_circ(), to generate a Qaptiva Circuit object

Returns:

If sep_measures is set to:

  • True: the result is a tuple composed of a Circuit and a list of qubits that should be measured

  • False: the result is a Circuit

Return type:

tuple or Circuit

to_job(quantum_circuit: qiskit.circuit.QuantumCircuit, *, observable: Observable | None = None, qubits: List[int] | None = None, nbshots: int = 1024)

This method takes a Qiskit circuit, converts it and returns a Qaptiva job.

Parameters:
  • quantum_circuit (QuantumCircuit) – A qiskit circuit

  • observable (Observable) – A qaptiva Observable

  • qubits (List[int]) – A list of integers corresponding to qubits used when the job is of type SAMPLE

Note

observable and qubits arguments are mutually exclusive arguments, the former should be given if the job to be executed is an "OBS" (observable) type, while the latter is only given if the job returned is supposed to be of "SAMPLE" type. If both are given an error is raised

Returns:

a Qaptiva job

Return type:

Job