SetToBasisState 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.Measurement

Package: Microsoft.Quantum.Type2.Core

Sets a qubit to a given computational basis state by measuring the qubit and applying a bit flip if needed.

operation SetToBasisState (desired : Result, target : Qubit) : Unit

Input

desired : Result

The basis state that the qubit should be set to.

target : Qubit

The qubit whose state is to be set.

Output : Unit

Remarks

As an invariant of this operation, calling M(q) immediately after SetToBasisState(result, q) will return result.