microsoft/qdk

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
661e9fc335e130cfeda06375919902ae5ffacf13

Branches

Tags

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

Clone

HTTPS

Download ZIP

library/std/diagnostics.qs

32lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4namespace Microsoft.Quantum.Diagnostics {
5 open QIR.Intrinsic;
6
7 function DumpMachine() : Unit {
8 body intrinsic;
9 }
10
11 function CheckZero(qubit : Qubit) : Bool {
12 body intrinsic;
13 }
14
15 function CheckAllZero(qubits : Qubit[]) : Bool {
16 for q in qubits {
17 if not CheckZero(q) {
18 return false;
19 }
20 }
21
22 return true;
23 }
24
25 /// Checks whether a classical condition is true, and throws an exception if it is not.
26 function Fact(actual : Bool, message : String) : Unit {
27 if (not actual) {
28 fail message;
29 }
30 }
31
32}
33