guppy_worker¶
Module Contents¶
Functions¶
Emulate a hugr on a local emulator. |
|
Build a hugr from a pytket circuit. |
|
Transform a new stack result to a pytket result. |
|
Build a n-qubit GHZ quantum state as Hugr. |
|
Build a Hugr from a string representation of a quantum program. |
|
Convert a Hugr to a string representation of a quantum program. |
|
Build a Hugr from a bytes representation of a quantum program. |
|
Convert a Hugr to a bytes representation of a quantum program. |
|
Normalize a Hugr package. |
|
Apply a pytket pass to a Hugr package. |
|
Remove redundant operations from a Hugr package. |
|
Squash Rz and PhasedX gates in a Hugr package. |
|
Convert a Hugr package to a QIR representation. |
Data¶
API¶
- worker = 'Worker(...)'¶
- Result = None¶
- emulate(hugr_package: hugr.package.Package, n_qubits: int, n_shots: int, seed: int | None = None) guppy_worker.Result¶
Emulate a hugr on a local emulator.
- Parameters:
- Returns:
The emulator result state.
- Return type:
- from_circuit(circuit: pytket.Circuit, name: str, use_arrays: bool = True) hugr.package.Package¶
Build a hugr from a pytket circuit.
- to_backend_result(results: guppy_worker.Result) pytket.backends.backendresult.BackendResult¶
Transform a new stack result to a pytket result.
- Parameters:
results (Result) – The original result.
- Returns:
The corresponding pytket result.
- Return type:
BackendResult
- ghz(size: int) hugr.package.Package¶
Build a n-qubit GHZ quantum state as Hugr.
- Parameters:
size (int) – The size of the state.
- Returns:
A Hugr representing the GHZ state.
- Return type:
Package
- from_str(package_str: str) hugr.package.Package¶
Build a Hugr from a string representation of a quantum program.
- Parameters:
package_str (str) – The string representation of the quantum program.
- Returns:
The compiled Hugr.
- Return type:
Package
- to_str(package: hugr.package.Package) str¶
Convert a Hugr to a string representation of a quantum program.
- Parameters:
package (Package) – The Hugr package to convert.
- Returns:
The string representation of the Hugr.
- Return type:
- from_bytes(package_bytes: bytes) hugr.package.Package¶
Build a Hugr from a bytes representation of a quantum program.
- Parameters:
package_bytes (bytes) – The bytes representation of the quantum program.
- Returns:
The compiled Hugr.
- Return type:
Package
- to_bytes(package: hugr.package.Package) bytes¶
Convert a Hugr to a bytes representation of a quantum program.
- Parameters:
package (Package) – The Hugr package to convert.
- Returns:
The bytes representation of the Hugr.
- Return type:
- normalize(package: hugr.package.Package) hugr.package.Package¶
Normalize a Hugr package.
- Parameters:
package (Package) – The Hugr package to normalize.
- Returns:
The normalized Hugr package.
- Return type:
Package
- apply_pytket_pass(package: hugr.package.Package, pytket_pass: pytket.passes.BasePass) hugr.package.Package¶
Apply a pytket pass to a Hugr package.
- Parameters:
package (Package) – The Hugr package to apply the pass to.
pytket_pass (BasePass) – The pytket pass to apply.
- Returns:
The Hugr package after applying the pass.
- Return type:
Package
- remove_redundancies(package: hugr.package.Package) hugr.package.Package¶
Remove redundant operations from a Hugr package.
- Parameters:
package (Package) – The Hugr package to optimize.
- Returns:
The optimized Hugr package.
- Return type:
Package
- squash_rz_phased_x(package: hugr.package.Package) hugr.package.Package¶
Squash Rz and PhasedX gates in a Hugr package.
- Parameters:
package (Package) – The Hugr package to optimize.
- Returns:
The optimized Hugr package.
- Return type:
Package