RuntimeError: Can only build replacement circuits for basic gates: QControlBox
Greetings there,
Hope you are well. I am trying to add tket2 to my library, and noticed that it doesn't support QControlBox. May I know when this would be added?
For the moment, I found that by setting rebase=False resolves the issue.
Hello, could you say a bit more about how you were using tket2, which function were you calling?
Greetings there,
Hope you are well. Gosh, I'm really embarrassed, I actually forgot to add the reproduction code. Really sorry about that. I believe I was running this:
from pytket import Circuit, OpType
from pytket.circuit import Op, QControlBox
from tket2.circuit import Tk2Circuit, render_circuit_mermaid
from tket2.passes import badger_pass
setattr(
Tk2Circuit,
"_repr_markdown_",
lambda self: f"```mermaid\n{render_circuit_mermaid(self)}\n```"
)
c = Circuit(3)
CX = QControlBox(Op.create(OpType.X), 1)
c.add_qcontrolbox(CX, [0, 1])
badger_pass(rebase=False).apply(c)
But now I'm getting a new error (which I wasn't getting before):
thread '<unnamed>' panicked at tket2-py/src/optimiser.rs:32:73:
called `Result::unwrap()` on an `Err` value: Deserialisation(Syntax("unknown variant `CustomOp`, expected one of `Module`, `FuncDefn`, `FuncDecl`, `AliasDecl`, `AliasDefn`, `Const`, `Input`, `Output`, `Call`, `CallIndirect`, `LoadConstant`, `LoadFunction`, `DFG`, `Extension`, `Tag`, `DataflowBlock`, `ExitBlock`, `TailLoop`, `CFG`, `Conditional`, `Case`"))
Fixed after updating to 0.4.1.