Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
005ea03
Completed prototype with design intent. This has not been tested yet.
PabloAndresCQ Sep 16, 2026
7f49fbf
Included prep_zero_plus_ft and used it to implement h_dynq
PabloAndresCQ Oct 9, 2026
d26c01d
Remove qed_policy call on measure_z_all
PabloAndresCQ Oct 9, 2026
5d92d29
fix errors to compile
hsemenenko Sep 18, 2026
c256850
Simplified code
PabloAndresCQ Oct 11, 2026
f790638
add test
hsemenenko Sep 18, 2026
befb637
fix return types
hsemenenko Sep 18, 2026
5226d45
fix release addr
hsemenenko Sep 18, 2026
306d071
add dynq cx test
hsemenenko Sep 18, 2026
54ad453
Some additional fixes
PabloAndresCQ Oct 12, 2026
8773fbd
Added more implement tests
PabloAndresCQ Oct 12, 2026
acfba79
Changed name allocate_block to allocate_block_id
PabloAndresCQ Oct 12, 2026
ea08e9f
Added encode tests
PabloAndresCQ Oct 12, 2026
4b87504
Replaced missing decode_qubit_type op with decode_qubit_measurement
PabloAndresCQ Oct 12, 2026
08b9b3c
Renamed measure_z as project_z and fixed issues related to qubit cons…
PabloAndresCQ Oct 12, 2026
8c993cc
Changed order of outputs of borrow
PabloAndresCQ Oct 12, 2026
672aee3
Fixed bug on _s_dynq and _t_dynq. Fixed _measure_all_z's signature to…
PabloAndresCQ Oct 16, 2026
c62c016
Use explicit test on the dictionary and fix bugs in the test that wer…
PabloAndresCQ Oct 16, 2026
4652d4e
Removed unnecessary test and changed a skip mark to xfail
PabloAndresCQ Oct 16, 2026
9387c3e
Use decorator @_register_op_replacement to remove boilerplate
PabloAndresCQ Oct 16, 2026
27d95e9
Dropped tests on implement_ops for _dynq ops
PabloAndresCQ Nov 4, 2026
1b05312
Now using _ToyK2Options rather than ToyK2EncoderParams, following #465
PabloAndresCQ Nov 4, 2026
ff75f9a
Dropping logical API means we have to support measure_z_dynq as a HUG…
PabloAndresCQ Nov 4, 2026
6d96173
Bumped number of extension ops in tests
PabloAndresCQ Nov 4, 2026
38cac1f
refactor(toyk2): encode state using borrow-array take/put not Option …
acl-cqc Nov 4, 2026
a52e823
Added more insightful effect annotations, per Max's request
PabloAndresCQ Nov 4, 2026
7fd91c8
Implement ops now uses RUS zero state prep, rather than expect it'll …
PabloAndresCQ Nov 4, 2026
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
10 changes: 8 additions & 2 deletions extensions/src/toy_k2/ops.rs

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to _dynq ops being dropped from the logical API (see latest changes in #326), we can no longer have measure_z_dynq as a compound op of logicals (it used to compose the bindings of project_z_dynq and free_dynq. So, I'm adding it as a new extension op, since we need to compile tket2.ops.MeasureFree to it.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use strum::{EnumIter, EnumString, IntoStaticStr};
/// The extension identifier.
pub const EXTENSION_ID: ExtensionId = ExtensionId::new_unchecked("guppyft.toy_k2.ops");
/// Extension version.
pub const VERSION: semver::Version = semver::Version::new(0, 1, 0);
pub const VERSION: semver::Version = semver::Version::new(0, 1, 1);

/// Logical ToyK2 operations.
#[derive(
Expand Down Expand Up @@ -81,6 +81,8 @@ pub enum ToyK2OpDef {
cx_dynq,
/// Project a dynamic logical qubit onto the Z basis without consuming it.
project_z_dynq,
/// Destructively measure a dynamic logical qubit in the Z basis.
measure_z_dynq,
/// Extraction of dynamic logical qubits from a block (consuming the block and emitting a borrowed block).
borrow,
/// Extraction of dynamic logical qubits from an already-borrowed block.
Expand Down Expand Up @@ -218,6 +220,10 @@ impl MakeOpDef for ToyK2OpDef {
vec![qubit_measurement_type(), dynamic_qubit_type()],
)
.into(),
measure_z_dynq => {
FuncValueType::new(vec![dynamic_qubit_type()], vec![qubit_measurement_type()])
.into()
}
borrow => FuncValueType::new(
vec![block_type(), int_type(6)],
vec![dynamic_qubit_type(), borrowed_block_type()],
Expand Down Expand Up @@ -272,7 +278,7 @@ mod tests {
fn test_toy_k2_ops_extension() {
assert_eq!(EXTENSION.name() as &str, "guppyft.toy_k2.ops");
assert_eq!(EXTENSION.types().count(), 0);
assert_eq!(EXTENSION.operations().count(), 31);
assert_eq!(EXTENSION.operations().count(), 32);
}

#[test]
Expand Down
Loading
Loading