jaqalpaq.transpilers.projectq package¶
- class jaqalpaq.transpilers.projectq.JaqalBackend(outfile=None, one_qubit_gate_map=None, two_qubit_gate_map=None, native_gates=None)¶
Bases:
projectq.cengines._basics.BasicEngine
A ProjectQ backend that converts the input circuit to Jaqal, building a
jaqalpup.core.Circuit
object which can be retrieved with thecircuit
property. If an output file is supplied, it also writes the Jaqal code to it when the engine is flushed.- Parameters
outfile (str) – Optionally specify a path to output Jaqal code to. If omitted, the Jaqal program is only available via the
circuit
property.one_qubit_gate_map (dict or None) – A dictionary mapping ProjectQ gate classes to functions taking as arguments an instance of that class and a
jaqalpup.core.NamedQubit
and returning a tuple of arguments forjaqalpup.core.Circuit.build_gate()
. Defaults to a mapping fromprojectq.ops.Rx
,projectq.ops.Ry
,projectq.ops.Rz
,projectq.ops.X
,projectq.ops.Y
, andprojectq.ops.SqrtX
to their QSCOUT counterparts.two_qubit_gate_map (dict or None) – A dictionary mapping ProjectQ gate classes to functions taking as arguments an instance of that class and two
jaqalpup.core.NamedQubit
ojects and returning a tuple of arguments forjaqalpup.core.Circuit.build_gate()
. Defaults to a mapping fromprojectq.ops.Rxx
andprojectq.ops.Ryy
to QSCOUT’s Mølmer-Sørenson gate.native_gates (dict or None) – The native gate set to target. If None, target the QSCOUT native gates.
- property circuit¶
Allows access to the Jaqal circuit generated by the transpilation process.
- is_available(cmd)¶
Returns whether Jaqal supports the specified command for transpilation. Any gate in the QSCOUT native gate set, as well as measure, allocate, deallocate, and barrier statements, are supported. Controlled gates are not supported. The
jaqalpaq.transpilers.projectq.get_engine_list()
function provides the ProjectQ engines that will compile a circuit to this gate basis.- Parameters
cmd (projectq.ops.Command) – The command for which to check availability.
- receive(command_list)¶
Converts each instruction in the input into its Jaqal equivalent and saves it. This should rarely be called directly by users; usually it will be called by
projectq.cengines.MainEngine
.- Parameters
command_list (list(projectq.ops.Command)) – The ProjectQ program to convert.
- jaqalpaq.transpilers.projectq.get_engine_list()¶
Creates a list of engines that compile to QSCOUT’s native gate set.
- Returns
The engines.
- Return type
list(projectq.cengines.BasicEngine)