SteaneInstance

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

A Steane architecture instance built by SteaneBuilder.build.

__delattr__(name)

Implement delattr(self, name).

__eq__(other)

Return self==value.

__init__(_spec: EncodeSpec) None
__repr__()

Return repr(self).

__setattr__(name, value)

Implement setattr(self, name, value).

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) Package[source]

Encode a computational package with the Steane instance.

implement_ops(pkg: Package) Package[source]

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