Skip to content

bloqade.cirq_utils.parallelize.parallelize

← Module overview

functionparallelizesource

bloqade.cirq_utils.parallelize.parallelize

Signature
def parallelize(circuit: cirq.Circuit, hyperparameters: dict[str, float] | None = None, auto_tag: bool = True) -> cirq.Circuit

Use linear programming to reorder a circuit so that it may be optimally be run in parallel. This is done using a DAG representation, as well as a heuristic similarity function to group parallelizable gates together.

Extra topological information (similarity) can be used by tagging each gate with the topological basis groups that it belongs to, for example

circuit.append(cirq.H(qubits[0]).with_tags(1,2,3,4)) represents that this gate is part of the topological basis groups 1,2,3, and 4.

Returns: cirq.Circuit - the optimized circuit, where each moment is as parallel as possible. it is also broken into native CZ gate set of {CZ, PhXZ}

Parameters

NameTypeDefaultDescription
circuitcirq.Circuitrequired
hyperparametersdict[str, float] | NoneNone
auto_tagboolTrue

Returns

cirq.Circuit

Inputs

circuit: cirq.Circuit - the static circuit to be optimized hyperparameters: dict[str, float] - hyperparameters for the optimization

  • “linear”: float (0.01) - the linear cost of each gate
  • “1q”: float (1.0) - the quadratic cost of 1q gates
  • “2q”: float (2.0) - the quadratic cost of 2q gates
  • “tags”: float (0.5) - the default weight of the topological basis.
source