AllowAtMostNQubits 작업
네임스페이스: Microsoft.Quantum.Diagnostics
패키지: Microsoft.Quantum.Standard
이 작업에 대한 호출과 해당 부호 사이에 는 지정된 수의 추가 큐비트가 using 문과 함께 할당됨을 어설션합니다.
operation AllowAtMostNQubits (nQubits : Int, message : String) : Unit is Adj
입력
nQubits: Int
할당될 수 있는 최대 큐비트 수입니다.
message: String
실패 시 표시할 메시지입니다.
출력 : 단위
예제
이 진단을 지원하는 컴퓨터에서 실행할 때 다음 코드 조각이 실패합니다.
within {
AllowAtMostNQubits(3, "Too many qubits allocated.");
} apply {
// Fails since this allocates four qubits.
using (register = Qubit[4]) {
}
}
설명
이 작업은 지원하지 않는 대상에 대한 no-op으로 대체될 수 있습니다.