ApplyToSubregister 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 an operation to a subregister of a register, with qubits specified by an array of their indices.

operation ApplyToSubregister (op : (Qubit[] => Unit), idxs : Int[], target : Qubit[]) : Unit

Input

op : Qubit[] => Unit

Operation to apply to subregister.

idxs : Int[]

Array of indices, indicating to which qubits the operation will be applied.

target : Qubit[]

Register on which the operation acts.

Output : Unit

Example

Create three qubit state $\frac{1}{\sqrt{2}}\ket{0}_2(\ket{0}_1\ket{0}_3+\ket{1}_1\ket{1}_3)$:

    using (register = Qubit[3]) {
        ApplyToSubregister(Exp([PauliX,PauliY],PI() / 4.0,_), [1,3], register);
    }

See Also