Definitions¶
- class guppylang.defs.GuppyFunctionDefinition(wrapped: Definition)[source]¶
Bases:
GuppyDefinition
,Generic
[P
,Out
]A Guppy function definition.
- compile() Package ¶
Compile a Guppy definition to HUGR.
- check() None ¶
Type-check a Guppy definition.
- emulator(n_qubits: int, builder: EmulatorBuilder | None = None) EmulatorInstance [source]¶
Compile this function for emulation with the selene-sim emulator.
Calls compile() to get the HUGR package and then builds it using the provided EmulatorBuilder configuration or a default one.
See
guppylang.emulator
for more details on the emulator.- Args:
n_qubits: The number of qubits to allocate for the function. builder: An optional EmulatorBuilder to use for building the emulator instance. If not provided, the default EmulatorBuilder will be used.
- Returns:
An EmulatorInstance that can be used to run the function in an emulator.
- class guppylang.defs.GuppyTypeVarDefinition(wrapped: Definition, _ty_var: TypeVar)[source]¶
Bases:
GuppyDefinition
Definition of a Guppy type variable.
- compile() Package ¶
Compile a Guppy definition to HUGR.
- check() None ¶
Type-check a Guppy definition.