ApplyIfOneC 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 controllable operation conditioned on a classical result value being one.

operation ApplyIfOneC<'T> (result : Result, (op : ('T => Unit is Ctl), target : 'T)) : Unit is Ctl

Description

Given an operation op and a result value result, applies op to the target if result is One. If Zero, nothing happens to the target. The suffix C indicates that the operation to be applied is controllable.

Input

result : Result

A measurement result that controls whether op is applied or not.

op : 'T => Unit is Ctl

An operation to be conditionally applied.

target : 'T

The input to which the operation is applied.

Output : Unit

Type Parameters

'T

The input type of the operation to be conditionally applied.

See Also