LocalFoldPass¶
- class LocalFoldPass(scale_factor, selection='random', exclude=None, rng=None)[source]¶
Bases:
TransformationPassPer-gate folding with fractional scale-factor support.
Each unitary gate
Gis replaced byG · (G† · G)^k. Fractional scale factors fold a selected subset of gates one extra time.- Parameters:
scale_factor (
float) – Real number ≥ 1.1.0is a pass-through.selection (
Literal['random','from_left','from_right']) – Which gates receive the extra fold.exclude (
set[str] |None) – Optional op names or arity shorthands to skip.rng (
Random|None) – Optional random source forselection="random".
- Raises:
ValueError – If
scale_factor< 1 orselectionis unknown.
Methods Summary
effective_scale(dag)Scale factor actually realised on
dag.run(dag)Fold
dagin place and return the mutated DAG.Methods Documentation