Skip to content

Instantly share code, notes, and snippets.

@billchenxi
Created May 14, 2020 06:14
Show Gist options
  • Save billchenxi/a81ffca9851eb21cd1c0017f7e901723 to your computer and use it in GitHub Desktop.
Save billchenxi/a81ffca9851eb21cd1c0017f7e901723 to your computer and use it in GitHub Desktop.
Q# Supoerposition
namespace Q_superposition {
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;
operation Superposition() : Result {
mutable state = Zero;
using (qubit = Qubit()) {
H(qubit);
set state = M(qubit);
Reset(qubit);
}
return state;
}
@EntryPoint()
operation Driver_Code() : Result {
Message($"Supoposition: ");
return Superposition();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment