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

operation ApplyIfOneCA<'T> (result : Result, (op : ('T => Unit is Adj + Ctl), target : 'T)) : Unit is Adj + 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 CA indicates that the operation to be applied is unitary (controllable and adjointable).

Input

result : Result

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

op : 'T => Unit is Adj + 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