Skip to content

Initialize

__RewriteU3ToInitialize

Bases: RewriteRule

Rewrite U3 gates to Initialize statements.

Note:

This rewrite is only valid in the context of logical qubits, where the U3 gate can be interpreted as initializing a qubit to an arbitrary state.

The U3 gate with parameters (theta, phi, lam) is equivalent to initializing a qubit to the state defined by those angles.

This rewrite also assumes there are no other U3 gates acting on the same qubits later in the circuit, as that would conflict with the initialization semantics.