microsoft/qdk

Public

mirrored from https://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.3.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

katas/content/multi_qubit_gates/arbitrary_controls/SolutionB.qs

13lines · modecode

1namespace Kata {
2 operation MultiControls (controls : Qubit[], target : Qubit, controlBits : Bool[]) : Unit is Adj + Ctl {
3 within {
4 for index in 0 .. Length(controls) - 1 {
5 if controlBits[index] == false {
6 X(controls[index]);
7 }
8 }
9 } apply {
10 Controlled X(controls,target);
11 }
12 }
13}