Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/change-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ rust:
- "badger-optimiser/**"
- "compile-rewriter/**"
- "tket1-passes/**"
- "tket-qec/**"

python:
- *rust-core
Expand Down
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ members = [
"tket-qsystem",
"tket1-passes",
"qis-compiler",
"tket-qec",
]
default-members = ["tket", "tket-qsystem"]

Expand Down
23 changes: 23 additions & 0 deletions tket-qec/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "tket-qec"
version = "0.1.0"
edition.workspace = true
rust-version.workspace = true

license.workspace = true
readme = "README.md"
# documentation = "https://docs.rs/tket-qec"
homepage.workspace = true
repository.workspace = true
description = "HUGR extensions for logical operations on QEC codes."
keywords = ["Quantum", "Quantinuum"]
categories = ["compilers"]

[lints]
workspace = true

[dependencies]
hugr.workspace = true
semver = "1.0.27"
strum = { workspace = true, features = ["derive"] }
tket-qsystem = { version = "0.23.0", path = "../tket-qsystem" }
9 changes: 9 additions & 0 deletions tket-qec/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# tket-qec

HUGR extensions for logical operations on QEC codes.

## License

This project is licensed under Apache License, Version 2.0 ([LICENSE][] or <http://www.apache.org/licenses/LICENSE-2.0>).

[LICENSE]: https://github.com/quantinuum/tket2/blob/main/LICENCE
47 changes: 47 additions & 0 deletions tket-qec/src/iceberg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//! HUGR extension for logical operations on the Iceberg code.
//!
//! The extension `tket.qec.iceberg.types` provides one new type: this is the
//! code block for the [[k+2, k, 2]] Iceberg code (parametrized by an even
//! integer k >= 2). This is a linear (non-copyable) type.
//!
//! ```
//! use tket_qec::iceberg::types::block_type;
//!
//! let block = block_type(6);
//! assert!(!block.copyable());
//! ```
//!
//! The extension `tket.qec.iceberg.ops` provides operations that act on this
//! block type.
//!
//! To allocate a new block, with all (logical) qubits initialized to zero, use
//! an `alloc_zero` operation. This is parametrized by k (the number of logical
//! qubits):
//!
//! ```
//! use tket_qec::iceberg::ops::EXTENSION;
//!
//! let alloczero = EXTENSION
//! .instantiate_extension_op("alloc_zero", [8.into()])
//! .unwrap();
//! ```
//!
//! Use the `free` operation to free a previously allocated block.
//!
//! Some of the operations (such as `all_x` or `cx_transverse`) operate purely
//! at the block level. Others (such as `x` or `cx`) take one or more indices
//! as parameters: these are (64-bit unsigned) integers less than `k`, which
//! address logical qubits within the block. Some operations also take an angle,
//! represented as a float in radians.
//!
//! All operations that take indices come in two versions, "static" and
//! "dynamic", depending on whether the indices are parameters to the operation
//! itself (in which case they must be statically known) or dynamic (in which
//! case they are integer inputs to the operation). The dynamic versions have
//! names ending in `_d`. For example, `x_d` takes a block and an integer as
//! inputs, and outputs the block. Note that whereas the static versions are
//! infallible (validity of indices is checked on construction), the dynamic
//! versions will panic if the indices are invalid.

pub mod ops;
pub mod types;
Loading
Loading