Expand description
TKET: The Hardware Agnostic Quantum Compiler
TKET is an open source quantum compiler developed by Quantinuum. Central to TKET’s design is its hardware agnosticism which allows researchers and quantum software developers to take advantage of its state of the art compilation for many different quantum architectures.
TKET circuits are represented using the HUGR IR defined in the
quantinuum-hugr crate. The Circuit
trait provides a high level
interface for working with HUGRs representing quantum circuits, and defines
a HUGR extension with quantum operations.
This crate includes a number of optimisation passes and rewrite utilities
for circuits, as well as interoperability with tket1
circuits via its
serial encoding.
Python bindings for TKET are available in the tket
package on PyPi.
§Example
use tket::Circuit;
use hugr::HugrView;
// Load a tket1 circuit.
let mut circ: Circuit = tket::serialize::load_tk1_json_file("../test_files/barenco_tof_5.json", None).unwrap();
assert_eq!(circ.qubit_count(), 9);
assert_eq!(circ.num_operations(), 170);
// Traverse the circuit and print the gates.
for command in circ.commands() {
println!("{:?}", command.optype());
}
// Render the circuit as a mermaid diagram.
println!("{}", circ.mermaid_string());
// Optimise the circuit.
tket::passes::apply_greedy_commutation(&mut circ);
Re-exports§
pub use circuit::Circuit;
pub use circuit::CircuitError;
pub use circuit::CircuitMutError;
pub use hugr;
Modules§
- circuit
- Quantum circuit representation and operations.
- extension
- This module defines the Hugr extensions used to represent circuits.
- optimiser
- Optimisers for circuit rewriting.
- passes
- Optimisation passes and related utilities for circuits.
- rewrite
- Transform circuits using rewrite rules.
- serialize
- Utilities for serializing circuits.
Structs§
- Hugr
- The Hugr data structure.
Enums§
Functions§
- op_
matches - Whether an op is a given TketOp.
- symbolic_
constant_ op - Initialize a new custom symbolic expression constant op from a string.