Skip to content

Commit 19c95dc

Browse files
committed
Implement (somewhat strange) control apply for Krons
1 parent aedd527 commit 19c95dc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/bloqade/pyqrack/squin/runtime.py

+11
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,17 @@ def apply(self, *qubits: PyQrackQubit, adjoint: bool = False) -> None:
111111
self.lhs.apply(qubits[0], adjoint=adjoint)
112112
self.rhs.apply(qubits[1], adjoint=adjoint)
113113

114+
def control_apply(self, *qubits: PyQrackQubit, adjoint: bool = False) -> None:
115+
# FIXME: this feels a bit weird and it's not very clear semantically
116+
# for now I'm settling for: apply to qubits if ctrls, using the same ctrls
117+
# for both targets
118+
assert len(qubits) > 2
119+
target1 = qubits[-2]
120+
target2 = qubits[-1]
121+
ctrls = qubits[:-2]
122+
self.lhs.control_apply(*ctrls, target1, adjoint=adjoint)
123+
self.rhs.control_apply(*ctrls, target2, adjoint=adjoint)
124+
114125

115126
@dataclass(frozen=True)
116127
class ScaleRuntime(OperatorRuntimeABC):

0 commit comments

Comments
 (0)