Skip to content

bloqade.lanes.rewrite.clifford2native.DecomposeCliffordToNative

← Module overview

classDecomposeCliffordToNativesource

bloqade.lanes.rewrite.clifford2native.DecomposeCliffordToNative

Bases: rewrite_abc.RewriteRule

Expand ``H``, ``CX``, ``CY`` and ``Swap`` into the squin Clifford statements that lower one-to-one onto Gemini's native gate set.

class DecomposeCliffordToNative

Idempotent: the expansions only emit statements the rule does not match.

The _hadamard / _controlled_* / _swap helpers return their statements in circuit order — element 0 runs first — and _expand preserves that order in the IR.

Their docstrings state the identity as an operator product, which reads the other way round, right to left. So

CX = sqrt(Y) . CZ . sqrt(Y)^dag (operator product)

is emitted as, and appears in the IR as,

sqrt_y_adj(targets); cz(controls, targets); sqrt_y(targets)

The two are reverses of each other by convention, not by accident: the conjugator adjacent to the ket in the product is the gate applied first. Read the formula when you want to check the conjugation direction, and the returned list when you want to know what the hardware runs.

methodrewrite_Statementsource

bloqade.lanes.rewrite.clifford2native.DecomposeCliffordToNative.rewrite_Statement

def rewrite_Statement(node: ir.Statement) -> rewrite_abc.RewriteResult

Parameters

NameTypeDescription
nodeir.Statement

Returns

rewrite_abc.RewriteResult

source