qtt.qiskit package

Submodules

qtt.qiskit.circuits module

qtt.qiskit.circuits.integrate_circuit(qc: QuantumCircuit, target_qubits: List[int], target_classical_bits: List[int] | None = None, number_of_qubits: int = 5, add_measurements: bool = True) QuantumCircuit[source]

Integrate circuit at specified qubits in a larger qubit system

This can be used for example to integrate a single-qubit experiment in a 5-qubit circuit to be executed on a 5-qubit device.

Parameters:
  • qc – QuantumCircuit to be integrated

  • target_qubits – List of qubits to map the circuit on

  • target_classical_bits – If None, then use the registers allocated to the target qubits

  • number_of_qubits – Number of qubits in the target system

  • add_measurements – If True, then add a measure statement for all the new qubits

Returns:

Integrated circuit

qtt.qiskit.passes module

class qtt.qiskit.passes.DecomposeCX(*args, **kwargs)[source]

Bases: TransformationPass

Decompose CX into CZ and single qubit rotations

run(dag: DAGCircuit) DAGCircuit[source]

Run the Decompose pass on dag.

Parameters:

dag – input dag.

Returns:

output dag where CX was expanded.

class qtt.qiskit.passes.DecomposeU(*args, **kwargs)[source]

Bases: TransformationPass

Decompose U gates into elementary rotations Rx, Ry, Rz

The U gates are decomposed using McKay decomposition.

run(dag: DAGCircuit) DAGCircuit[source]

Run the Decompose pass on dag.

Parameters:

dag – input DAG.

Returns:

Output DAG where U gates have been decomposed.

ugate_replacement_circuit(ugate)[source]
class qtt.qiskit.passes.DelayPass(*args, **kwargs)[source]

Bases: TransformationPass

Adds delay gates when the qubits are idle. For every layer of the circuit it finds the gate that lasts the longest and applies appropriate delays on the other qubits.

add_delay_to_dag(duration, dag, qargs, cargs)[source]
run(dag)[source]

Run a pass on the DAGCircuit. This is implemented by the pass developer.

Parameters:

dag (DAGCircuit) – the dag on which the pass is run.

Raises:

NotImplementedError – when this is left unimplemented for a pass.

class qtt.qiskit.passes.LinearTopologyParallelPass(*args, **kwargs)[source]

Bases: TransformationPass

Adds barriers to enforce a linear topology

The barrier are placed between gates such that no two qubit gates are executed at the same time and only single qubit gates on non-neighboring qubits can be executed in parallel. It assumes a linear topology.

run(dag)[source]

Run a pass on the DAGCircuit. This is implemented by the pass developer.

Parameters:

dag (DAGCircuit) – the dag on which the pass is run.

Raises:

NotImplementedError – when this is left unimplemented for a pass.

class qtt.qiskit.passes.RemoveDiagonalGatesAfterInput(*args, **kwargs)[source]

Bases: TransformationPass

Remove diagonal gates (including diagonal 2Q gates) at the start of a circuit.

Transpiler pass to remove diagonal gates (like RZ, T, Z, etc) at the start of a circuit. Including diagonal 2Q gates. Nodes after a reset are also included.

run(dag)[source]

Run the RemoveDiagonalGatesBeforeMeasure pass on dag.

Parameters:

dag (DAGCircuit) – the DAG to be optimized.

Returns:

the optimized DAG.

Return type:

DAGCircuit

class qtt.qiskit.passes.RemoveGateByName(*args, **kwargs)[source]

Bases: TransformationPass

Return a circuit with all gates with specified name removed.

This transformation is not semantics preserving.

run(dag: DAGCircuit) DAGCircuit[source]

Run the RemoveGateByName pass on dag.

class qtt.qiskit.passes.RemoveSmallRotations(*args, **kwargs)[source]

Bases: TransformationPass

Return a circuit with small rotation gates removed.

run(dag: DAGCircuit) DAGCircuit[source]

Run the pass on dag. :param dag: input dag.

Returns:

Output dag with small rotations removed

class qtt.qiskit.passes.SequentialPass(*args, **kwargs)[source]

Bases: TransformationPass

Adds barriers between gates to make the circuit sequential.

run(dag)[source]

Run a pass on the DAGCircuit. This is implemented by the pass developer.

Parameters:

dag (DAGCircuit) – the dag on which the pass is run.

Raises:

NotImplementedError – when this is left unimplemented for a pass.