OptimizationLevel¶
- class guppylang.optimizer.OptimizationLevel(*values)[source]¶
Optimization level used when compiling a Guppy program.
- Classical = 'classical'¶
Restricts optimization to classical operations.
The program will execute the same quantum operations as the original source, but may have a simplified control flow structure.
Currently, this runs tket’s Normalize pass to simplify classical control flow and remove redundant classical operations. This set may be modified in future versions.
- Default = 'default'¶
Guppy’s standard optimization level.
This may include both classical and quantum optimizations that do not alter the program’s gateset. Calling
main.compile()ormain.emulator(...)directly uses this level.Currently, this applies pytket’s RemoveRedundancies after the optimizations in
OptimizationLevel.Classical. This may be modified in future versions.
- Minimal = 'minimal'¶
Applies only structural rewrites needed to produce executable output.
This is useful for low-level program analysis or when more control over the optimization passes is desired.