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/states/src/StatePrep.qs

18lines · modecode

1/// # Summary
2/// Prepares the state 1/2 (|00⟩ + i|01⟩ - |10⟩ - i|11⟩) = |-⟩ ⊗ |i⟩.
3operation PrepareStateWithComplexPhases(qs : Qubit[]) : Unit {
4 H(qs[0]);
5 Z(qs[0]);
6 H(qs[1]);
7 S(qs[1]);
8}
9
10/// # Summary
11/// Prepares the state 1/2 (-|00⟩ - i|01⟩ + |10⟩ + i|11⟩) = -(|-⟩ ⊗ |i⟩) = -|-⟩ ⊗ |i⟩.
12operation PrepareStateWithGlobalPhase(qs : Qubit[]) : Unit {
13 H(qs[0]);
14 Z(qs[0]);
15 X(qs[0]);
16 H(qs[1]);
17 S(qs[1]);
18}
19