decompose_from_cirq_style_method#
View source on GitHub
|
Return a CompositeBloq decomposition using a cirq-style decompose method.
qualtran.cirq_interop.decompose_from_cirq_style_method(
bloq: qualtran.Bloq,
method_name: str = 'decompose_from_registers'
) -> qualtran.CompositeBloq
The bloq must have a method with the given name (by default: “decompose_from_registers”) that satisfies the following function signature:
def decompose_from_registers(
self, *, context: cirq.DecompositionContext, **quregs: NDArray[cirq.Qid]
) -> cirq.OP_TREE:
This must yield a list of cirq.Operations using cirq.Gate.on(...), Bloq.on(…),
GateWithRegisters.on_registers(…), or Bloq.on_registers(…).
If Bloq.on() is used, the bloqs will be retained in their native form in the returned
composite bloq. If cirq.Gate.on() is used, the gates will be wrapped in CirqGateAsBloq.
View source on GitHub