ApplyControlledOnBitString 작업

정규화된 이름: Std.Canon.ApplyControlledOnBitString

operation ApplyControlledOnBitString<'T>(bits : Bool[], oracle : ('T => Unit is Adj + Ctl), controlRegister : Qubit[], target : 'T) : Unit is Adj + Ctl

요약

oracle target지정된 상태에 있는 경우 controlRegisterbits 적용됩니다.

묘사

지정된 비트 마스크 oracle지정된 상태에서 제어되는 targetbits 단위 연산을 적용합니다. bits[i] 비트는 controlRegister[i]큐비트에 해당합니다. bits 지정한 패턴은 controlRegister보다 짧을 수 있습니다. 이 경우 추가 제어 큐비트는 무시됩니다(즉, |0⟩ 또는 |1⟩에서 제어되지 않음). bits controlRegister보다 길면 오류가 발생합니다.

입력

비트

지정된 단위 작업을 제어할 비트 문자열입니다.

오라클

대상에 적용할 단위 작업입니다.

과녁

입력으로 oracle 전달할 대상입니다.

controlRegister

oracle애플리케이션을 제어하는 양자 레지스터입니다.

본보기

// When bits = [1,0,0] oracle is applied if and only if controlRegister
// is in the state |100⟩.
use t = Qubit();
use c = Qubit[3];
X(c[0]);
ApplyControlledOnBitString([true, false, false], X, c, t);
Message($"{M(t)}"); // Prints `One` since oracle `X` was applied.