정규화된 이름: Std.Diagnostics.StartCountingQubits
operation StartCountingQubits() : Unit
요약
할당된 큐비트 수를 계산하기 시작합니다. 큐비트가 이미 계산되고 있으면 실패합니다.
묘사
이 작업을 사용하면 StopCountingQubits 호출될 때까지 할당된 큐비트 수를 계산할 수 있습니다.
카운터는 새 고유 큐비트가 할당된 경우에만 증가하므로 별도의 할당에서 동일한 큐비트를 여러 번 다시 사용하면 카운터가 증가하지 않습니다.
발언
이 작업은 지정된 범위에서 할당된 고유 큐비트 수를 추적하는 데 유용합니다.
StopCountingQubits함께 지정된 작업에서 예상보다 많은 큐비트를 할당하지 않는지 확인하는 데 사용할 수 있습니다. 예를 들어
StartCountingQubits();
testOperation();
let qubitsAllocated = StopCountingQubits();
Fact(qubitsAllocated <= 4, "Operation should not allocate more than 4 qubits.");