Skip to content

Commit 8fab893

Browse files
committed
fix comments after cr
1 parent bf13c49 commit 8fab893

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

algorithms/foundational/simon/simon.qmod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Simon algorithm with a minimal oracle example
1+
// Simon Algorithm with a Minimal Oracle Example
22

3-
// This program prepare an input superposition and applies a Simon function.
3+
// This example prepares an input superposition and applies a Simon function.
44
// We focus only on the quantum wrapper and a very simple oracle,
55
// without classical postprocessing or full secret recovery.
66

algorithms/number_theory_and_cryptography/discrete_log/discrete_log.qmod

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// Discrete logarithmic problem using Shor's Algorithm
1+
// Discrete Logarithmic Problem Using Shor's Algorithm
22

3-
// This example implements the quantum part of a discrete logarithm solver
4-
// We start by preparing a uniform superposition over `alpha` and `beta`
5-
// then evaluating the oracle and applying inverse QFT to extract phase information
6-
// where the exponent is encoded in the power of `pw`
3+
// This example implements the quantum part of a discrete logarithm solver.
4+
// We start by preparing a uniform superposition over `alpha` and `beta`,
5+
// then evaluating the oracle and applying inverse QFT to extract phase information,
6+
// where the exponent is encoded in the power of `pw`.
77

88
qfunc modular_exponentiation(N: int, a: int, x: qbit[], pw: qbit[]) {
99
repeat (index: pw.len) {
@@ -20,12 +20,6 @@ qfunc discrete_log_oracle(g_generator: int, x_element: int, N_modulus: int, alph
2020
modular_exponentiation(N_modulus, g_generator, func_res, beta);
2121
}
2222

23-
// problem parameters
24-
generator: int = 7;
25-
target: int = 3;
26-
modulus: int = 13;
27-
order: int = 12;
28-
reg_len: int = ceiling(log(order, 2)) + 1;
2923

3024
// Compute `discrete_log_oracle` on the `func_res` variable. `func_res` is of size log(N)
3125
qfunc discrete_log(generator: int, target: int, modulus: int, order: int, output alpha: qnum, output beta: qnum, output func_res: qnum) {
@@ -42,6 +36,13 @@ qfunc discrete_log(generator: int, target: int, modulus: int, order: int, output
4236
}
4337
}
4438

39+
// problem parameters
40+
generator: int = 7;
41+
target: int = 3;
42+
modulus: int = 13;
43+
order: int = 12;
44+
reg_len: int = ceiling(log(order, 2)) + 1;
45+
4546
qfunc main(output alpha: qnum, output beta: qnum, output func_res: qnum) {
4647
discrete_log(generator, target, modulus, order, alpha, beta, func_res);
4748
}

algorithms/number_theory_and_cryptography/hidden_shift/hidden_shift.qmod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Hidden shift (bent Boolean functions)
22

3-
// This problem describes how to find the hidden shift s, given two functions:
3+
// This example 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).
55
// The functions are represented as quantum oracles that apply a phase flip.
66
// A bent function is a special kind of Boolean function with maximum distance from all linear functions.

algorithms/number_theory_and_cryptography/shor/shor.qmod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Shor's Factoring Algorithm
22

33
// Performs `Shor's factorization algorithm on a given integer N.
4-
// The core part of Shor's algorithm, is the period finding of the function f(x) = a^x mod N
4+
// The core part of Shor's algorithm, is the period finding of the function f(x) = a^x mod N.
55
// This can be done using Quantum phase estimation (QPE) algorithm.
6-
// We work with the `qpe_flexible` function, that allows to pass a unitary with a specified powered operation
6+
// We work with the `qpe_flexible` function, that allows to pass a unitary with a specified powered operation.
77

88
qfunc period_finding(n: int, a: int, x: qnum, phase_var: qnum) {
99
x ^= 1;

algorithms/quantum_primitives/swap_test/swap_test.qmod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
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) gives:
4+
// The measurement result (test) gives:
55
// P(test = |0>) = 1/2 * (1 + |<psi1|psi2>|^2)
6-
// Meaning that higher probability of |0> is a higher overlap between the states.
6+
// Higher probability of |0> is a higher overlap between the states.
77

88
error_bound: real = 0.0;
99
psi1_amplitudes: real[] = [0.41, -0.17, 0.30, 0.04, 0.55, -0.34, -0.33, 0.54];

0 commit comments

Comments
 (0)