slice_by_depth

slice_by_depth(circuit, max_slice_depth)[source]

Split a QuantumCircuit into slices based on depth.

This function transforms the input circuit into a DAGCircuit and batches the sequence of depth-1 layers output from layers() into slices of depth not exceeding max_slice_depth. This is achieved by composing layers into slices until the max slice depth is reached and then starting a new slice with the next layer. The final slice may be composed of fewer than max_slice_depth layers.

Parameters:
  • circuit (QuantumCircuit) – The circuit to be split.

  • max_slice_depth (int) – The maximum depth of a given slice.

Returns:

A sequence of QuantumCircuit objects, one for each slice.

Return type:

list[QuantumCircuit]