microsoft/qdk

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
billti/copilot

Branches

Tags

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

Clone

HTTPS

Download ZIP

samples/testing/operations/src/CustomOperation.qs

18lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3
4namespace CustomOperation {
5 /// # Summary
6 /// CNOT based SWAP operation for testing with `TestEquivalence` operation.
7 ///
8 /// # Input
9 /// ## q1
10 /// First input qubit
11 /// ## q2
12 /// Second input qubit
13 operation ApplySWAP(q1 : Qubit, q2 : Qubit) : Unit is Ctl + Adj {
14 CNOT(q1, q2); // q1, q1 xor q2
15 CNOT(q2, q1); // q2, q1 xor q2
16 CNOT(q1, q2); // q2, q1
17 }
18}
19