Skip to content

Commit

Permalink
Also adding definition for UnitaryGate
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderivrii committed Feb 10, 2025
1 parent 1108536 commit f72152e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion crates/circuit/src/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2848,7 +2848,19 @@ impl Operation for UnitaryGate {
}
}
fn definition(&self, _params: &[Param]) -> Option<CircuitData> {
None
Python::with_gil(|py| -> Option<CircuitData> {
let py_op = self
.create_py_op(py, &ExtraInstructionAttributes::default())
.unwrap();
match py_op.getattr(py, intern!(py, "definition")) {
Ok(definition) => definition
.getattr(py, intern!(py, "_data"))
.ok()?
.extract::<CircuitData>(py)
.ok(),
Err(_) => None,
}
})
}
fn standard_gate(&self) -> Option<StandardGate> {
None
Expand Down

0 comments on commit f72152e

Please sign in to comment.