SinglyControlledA function

Warning

This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.

Please see https://aka.ms/qdk.api for the API documentation for the Modern QDK.

Namespace: Microsoft.Quantum.Canon

Package: Microsoft.Quantum.Standard

Given a controllable operation, returns a controlled version of that operation accepting exactly one control qubit.

function SinglyControlledA<'T> (op : ('T => Unit is Adj + Ctl)) : ((Qubit, 'T) => Unit is Adj + Ctl)

Input

op : 'T => Unit is Adj + Ctl

The operation to be controlled.

Output : (Qubit,'T) => Unit is Adj + Ctl

A controlled variant of op accepting exactly one control qubit.

Type Parameters

'T

Example

To add the weight (number of "1" bits) of a control register to a target register:

ApplyToEachCA(
    SinglyControlledA(IncrementByInteger)(_, (1, target)),
    controls)
);

See Also