Skip to content

Commit

Permalink
feat: Support "add" operations in the ecc loader (#109)
Browse files Browse the repository at this point in the history
Required for some #104 ecc sets.

Note that the published `tket-json-rs` dropped the `tket2` feature. But
it should be fine once CQCL/tket-json-rs#13 is
merged and published.
  • Loading branch information
aborgna-q authored Sep 14, 2023
1 parent b2882d6 commit e40d70d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/json/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ impl TryFrom<&OpType> for JsonOp {
T2Op::Measure => JsonOpType::Measure,
T2Op::RzF64 => JsonOpType::Rz,
T2Op::RxF64 => JsonOpType::Rx,
// TODO: Use a TK2 opaque op once we update the tket-json-rs dependency.
T2Op::AngleAdd => JsonOpType::AngleAdd,
T2Op::TK1 => JsonOpType::TK1,
T2Op::PhasedX => JsonOpType::PhasedX,
T2Op::ZZMax => JsonOpType::ZZMax,
Expand Down
5 changes: 5 additions & 0 deletions src/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub enum T2Op {
RxF64,
PhasedX,
ZZPhase,
AngleAdd,
TK1,
}
#[derive(Clone, Copy, Debug, Serialize, Deserialize, EnumIter, Display, PartialEq, PartialOrd)]
Expand Down Expand Up @@ -127,6 +128,10 @@ impl SimpleOpEnum for T2Op {
Measure => FunctionType::new(one_qb_row, type_row![QB_T, BOOL_T]),
RzF64 | RxF64 => FunctionType::new(type_row![QB_T, FLOAT64_TYPE], one_qb_row),
PhasedX => FunctionType::new(type_row![QB_T, FLOAT64_TYPE, FLOAT64_TYPE], one_qb_row),
AngleAdd => FunctionType::new(
type_row![FLOAT64_TYPE, FLOAT64_TYPE],
type_row![FLOAT64_TYPE],
),
TK1 => FunctionType::new(
type_row![QB_T, FLOAT64_TYPE, FLOAT64_TYPE, FLOAT64_TYPE],
one_qb_row,
Expand Down
1 change: 1 addition & 0 deletions src/passes/taso/qtz_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ fn map_op(opstr: &str) -> Op {
"tdg" => T2Op::Tdg,
"sdg" => T2Op::Sdg,
"rz" => T2Op::RzF64,
"add" => T2Op::AngleAdd,
x => panic!("unknown op {x}"),
}
.into()
Expand Down

0 comments on commit e40d70d

Please sign in to comment.