ApplyWithInputTransformation 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

Given an operation that accepts some input, a function that returns an output compatible with that operation, and an input to that function, applies the operation using the function to transform the input to a form expected by the operation.

operation ApplyWithInputTransformation<'T, 'U> (fn : ('U -> 'T), op : ('T => Unit), input : 'U) : Unit

Input

fn : 'U -> 'T

A function that transforms the given input into a form expected by the operation.

op : 'T => Unit

The operation to be applied.

input : 'U

An input to the function.

Output : Unit

Type Parameters

'T

'U

Example

The following call uses LittleEndianAsBigEndian function to apply an operation designed for BigEndian user defined type inputs to an input of type LittleEndian user defined type:

ApplyWithInputTransformation(LittleEndianAsBigEndian, ApplyXorInPlaceBE, LittleEndian(qubits));

See Also