SteaneInstance

class guppyft.code.steane.encode.SteaneInstance(_spec: EncodeSpec)[source]

A Steane architecture instance built by SteaneBuilder.build.

__eq__(other)

Return self==value.

__init__(_spec: EncodeSpec) → None
__repr__()

Return repr(self).

check_may_encode(hugr: Package) → None[source]

Check whether any issues can be detected that would arise when trying to encode the given package, e.g. the package containing unsupported gates.

Note that this function returning without error is not a guarantee that a subsequent call to encode will succeed.

emulator(pkg: Package, n_qubits: int, builder: EmulatorBuilder | None = None) → EmulatorInstance[source]

Encode a hugr Package and build an emulator for it.

Parameters:
  • pkg – The computational hugr package.

  • n_qubits – Number of physical qubits available to the emulator.

  • builder – Optional EmulatorBuilder to use; defaults to a new one.

encode(pkg: Package, *, as_bytes: Literal[False] = False) → Package[source]
encode(pkg: Package, *, as_bytes: Literal[True]) → bytes

Encode a computational package with the Steane instance.

implement_ops(pkg: Package, *, as_bytes: Literal[False] = False) → Package[source]
implement_ops(pkg: Package, *, as_bytes: Literal[True]) → bytes

Implement logical ops in pkg using this instance’s op implementations.