microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/fix-wasm-logging-issue

Branches

Tags

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

Clone

HTTPS

Download ZIP

samples/testing/operations/src/OperationEquivalence.qs

15lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3
4import Std.Diagnostics.*;
5import CustomOperation.*;
6/// # Summary
7/// Verifies the equivalence of quantum operations up to a global phase using `Fact` function
8/// and the `CheckOperationsAreEqual` operation. You can either run this here,
9/// by clicking `Run` in VsCode or call `TestEquivalence` operation in Python.
10@EntryPoint()
11operation TestEquivalence() : Unit {
12 let actual = qs => ApplySWAP(qs[0], qs[1]);
13 let expected = qs => SWAP(qs[0], qs[1]);
14 Fact(CheckOperationsAreEqual(2, actual, expected), "Actual and expected operation should be same");
15}
16