ApplyIfElseBC 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 one of two controllable operations, depending on the value of a classical bit.

operation ApplyIfElseBC<'T, 'U> (bit : Bool, (trueOp : ('T => Unit is Ctl), trueInput : 'T), (falseOp : ('U => Unit is Ctl), falseInput : 'U)) : Unit is Ctl

Description

Given a bit bit, applies the operation trueOp with trueInput as its input when bit is true, and applies falseOp(falseInput) when bit is false.

Input

bit : Bool

The boolean value used to determine whether trueOp or falseOp is applied.

trueOp : 'T => Unit is Ctl

The controllable operation to be applied when bit is true.

trueInput : 'T

The input to be provided to trueOp when bit is true.

falseOp : 'U => Unit is Ctl

The controllable operation to be applied when bit is false.

falseInput : 'U

The input to be provided to falseOp when bit is false.

Output : Unit

Type Parameters

'T

The input type of the operation trueOp to be conditionally applied.

'U

The input type of the operation falseOp to be conditionally applied.

See Also