Crates.io | tket2 |
lib.rs | tket2 |
version | 0.6.0 |
source | src |
created_at | 2024-05-24 15:04:50.787757 |
updated_at | 2024-10-15 10:22:26.445001 |
description | Quantinuum's TKET2 Quantum Compiler |
homepage | https://github.com/CQCL/tket2 |
repository | https://github.com/CQCL/tket2 |
max_upload_size | |
id | 1251211 |
size | 458,015 |
TKET2 is an open source quantum compiler developed by Quantinuum. Central to TKET2's design is its hardware agnosticism which allows researchers and quantum software developers to take advantage of its powerful compilation for many different quantum architectures.
Circuits are represented using the HUGR IR defined in the hugr crate. TKET2 augments Hugr with
Circuit
trait, providing a high-level interface for working with HUGRs representing quantum circuitsThis crate is interoperable with tket1
circuits via its
serial encoding.
Defining a circuit in TKET2 is currently done by using the low-level hugr Builder API, or by loading tket1 circuits from JSON files.
use tket2::{Circuit, Hugr};
// Load a tket1 circuit.
let mut circ: Hugr = tket2::json::load_tk1_json_file("test_files/barenco_tof_5.json").unwrap();
assert_eq!(circ.qubit_count(), 9);
assert_eq!(circ.num_gates(), 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.
tket2::passes::apply_greedy_commutation(&mut circ);
Please read the API documentation here.
portmatching
Enables pattern matching using the portmatching
crate.
rewrite-tracing
Adds opt-in tracking of the rewrites applied to a circuit.
See CHANGELOG for a list of changes. The minimum supported rust version will only change on major releases.
See DEVELOPMENT.md for instructions on setting up the development environment.
This project is licensed under Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0).