File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
number_theory_and_cryptography/hidden_shift
quantum_primitives/swap_test Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change 1- // Hidden shift (bent Boolean functions) — simple demo instance
1+ // Hidden shift (bent Boolean functions)
22
33// This problem describes how to find the hidden shift s, given two functions:
44// a bent function f(x) and its shifted version g(x) = f(x xor s).
5- // The functions are represented as quantum oracles that apply a phase flip
6- // A bent function is a special kind of Boolean function with maximum distance from all linear functions
5+ // The functions are represented as quantum oracles that apply a phase flip.
6+ // A bent function is a special kind of Boolean function with maximum distance from all linear functions.
77
88num_variables: int = 4;
99
1010// define both functions:
11- // f(x) = (x0 & x1) xor (x2 & x3)
1211qperm bent_function(const vars: qbit[num_variables], res: qbit) {
1312 res ^= (vars[0] & vars[1]) ^ (vars[2] & vars[3]);
1413}
Original file line number Diff line number Diff line change 11// Swap Test (quantum primitive)
22
33// This example prepares two (fixed) quantum states |psi1> and |psi2>, then runs `swap_test`.
4- // the measurement result (test) will gives:
4+ // the measurement result (test) gives:
55// P(test = |0>) = 1/2 * (1 + |<psi1|psi2>|^2)
66// Meaning that higher probability of |0> is a higher overlap between the states.
77
You can’t perform that action at this time.
0 commit comments