ApplyToEachC operation


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

Please see for the API documentation for the Modern QDK.

Namespace: Microsoft.Quantum.Canon

Package: Microsoft.Quantum.Standard

Applies a single-qubit operation to each element in a register. The modifier C indicates that the single-qubit operation is controllable.

operation ApplyToEachC<'T> (singleElementOperation : ('T => Unit is Ctl), register : 'T[]) : Unit is Ctl


singleElementOperation : 'T => Unit is Ctl

Operation to apply to each qubit.

register : 'T[]

Array of qubits on which to apply the given operation.

Output : Unit

Type Parameters


The target on which the operation acts.


Prepare a three-qubit $\ket{+}$ state:

using (register = Qubit[3]) {
    ApplyToEachC(H, register);

See Also