ApplyControlledOnInt operation

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

Applies a unitary operation on the target register if the control register state corresponds to a specified nonnegative integer.

operation ApplyControlledOnInt<'T> (numberState : Int, oracle : ('T => Unit is Adj + Ctl), controlRegister : Qubit[], targetRegister : 'T) : Unit is Adj + Ctl

Input

numberState : Int

A nonnegative integer on which the operation oracle should be controlled.

oracle : 'T => Unit is Adj + Ctl

A unitary operation to be controlled.

controlRegister : Qubit[]

A quantum register that controls application of oracle.

targetRegister : 'T

A register on which to apply oracle.

Output : Unit

Type Parameters

'T

Remarks

The value of numberState is interpreted using a little-endian encoding.

numberState must be at most $2^\texttt{Length(controlRegister)} - 1$. For example, numberState = 537 means that oracle is applied if and only if controlRegister is in the state $\ket{537}$.