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/CustomOperation.qs

16lines · modecode

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