Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

qamomile.circuit.multi_controlled_x

Provide a semantic multi-controlled X with a capability-driven fallback.

Overview

FunctionDescription
configure_compositeConfigure a QKernel to remain visible as a named composite call.
multi_controlled_xFlip a target when every qubit in a control register is one.
ClassDescription
CallPolicyDescribe the default lowering policy for a callable call.

Constants

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:

NameTypeDescription
kernelQKernel[..., Any]Kernel to configure.
namestr | NonePublic callable name. Defaults to the kernel name.
namespacestr | NoneExplicit stable callable namespace. None derives one from the decorated function’s module, qualified name, and source location. Defaults to None.
gate_typeCompositeGateTypeInternal stdlib classification. Defaults to CUSTOM.
policyCallPolicyLowering policy. Defaults to PRESERVE_BOX.
implementationsSequence[CallableImplementation] | NoneOptional implementation candidates.
semantic_argumentsMapping[str, Any] | NoneSerializer-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:

NameTypeDescription
controlsVector[Qubit]Non-empty control register.
targetQubitTarget 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