Provide a semantic multi-controlled X with a capability-driven fallback.
Overview¶
| Function | Description |
|---|---|
configure_composite | Configure a QKernel to remain visible as a named composite call. |
multi_controlled_x | Flip a target when every qubit in a control register is one. |
| Class | Description |
|---|---|
CallPolicy | Describe the default lowering policy for a callable call. |
Constants¶
mcx=multi_controlled_xShort public alias for :func:multi_controlled_x.
Functions¶
configure_composite [source]¶
def configure_composite(
kernel: QKernel[..., Any],
*,
name: str | None = None,
namespace: str | None = None,
gate_type: CompositeGateType = CompositeGateType.CUSTOM,
policy: CallPolicy = CallPolicy.PRESERVE_BOX,
implementations: Sequence[CallableImplementation] | None = None,
semantic_arguments: Mapping[str, Any] | None = None,
) -> QKernel[..., Any]Configure a QKernel to remain visible as a named composite call.
This mutates and returns the same QKernel object. No wrapper class or alternate call protocol is introduced.
Parameters:
| Name | Type | Description |
|---|---|---|
kernel | QKernel[..., Any] | Kernel to configure. |
name | str | None | Public callable name. Defaults to the kernel name. |
namespace | str | None | Explicit stable callable namespace. None derives one from the decorated function’s module, qualified name, and source location. Defaults to None. |
gate_type | CompositeGateType | Internal stdlib classification. Defaults to CUSTOM. |
policy | CallPolicy | Lowering policy. Defaults to PRESERVE_BOX. |
implementations | Sequence[CallableImplementation] | None | Optional implementation candidates. |
semantic_arguments | Mapping[str, Any] | None | Serializer-friendly arguments that are part of the operation’s meaning rather than its decomposition. Defaults to no semantic arguments. |
Returns:
QKernel[..., Any] — QKernel[..., Any]: The same configured kernel instance.
multi_controlled_x [source]¶
def multi_controlled_x(controls: Vector[Qubit], target: Qubit) -> tuple[Vector[Qubit], Qubit]Flip a target when every qubit in a control register is one.
The function keeps the familiar qkernel call style while preserving one semantic operation for targets with an arbitrary-width controlled-X gate. Other targets execute the body through Qamomile’s controlled-gate lowering when their declared control-width profile admits it; narrower targets reject the call at the capability boundary.
Parameters:
| Name | Type | Description |
|---|---|---|
controls | Vector[Qubit] | Non-empty control register. |
target | Qubit | Target qubit to conditionally flip. |
Returns:
tuple[Vector[Qubit], Qubit] — tuple[Vector[Qubit], Qubit]: Updated controls and target.
Classes¶
CallPolicy [source]¶
class CallPolicy(enum.Enum)Describe the default lowering policy for a callable call.
Attributes¶
INLINENATIVE_FIRSTPRESERVE_BOX