Skip to content

Commit 7065b43

Browse files
revised quantum counting iqae and hadamard test
1 parent 55588cb commit 7065b43

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

algorithms/amplitude_amplification_and_estimation/quantum_counting/quantum_counting_iqae.qmod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ qstruct OracleVars {
1515

1616

1717

18-
PROBLEM_QUBITS: int = 4; // 4 qubits
1918
THRESHOLD: int = 2; // predicate: (a + b) <= THRESHOLD
2019

2120

@@ -40,7 +39,7 @@ qfunc iqae_state_preparation(vars: OracleVars, ind: qbit) {
4039
}
4140

4241
// Constructs the state expected by `amplitude_amplification`:
43-
// interprets the first PROBLEM_QUBITS as OracleVars and the last qubit as an indicator.
42+
// interprets the first 4 qubits as OracleVars and the last qubit as an indicator.
4443
qfunc space_transform(est_var: qbit[]) {
4544
// est_var = [problem_vars..., indicator]
4645
iqae_state_preparation(
@@ -52,7 +51,7 @@ qfunc space_transform(est_var: qbit[]) {
5251

5352
qfunc main(k: int, output indicator: qbit) {
5453
est_var: qbit[];
55-
problem_vars: qbit[PROBLEM_QUBITS];
54+
problem_vars: OracleVars;
5655

5756
allocate(problem_vars); // Initiating the indicator qubit
5857
allocate(indicator); // Solution space qubits

tutorials/basic_tutorials/quantum_primitives/hadamard_test/hadamard_test.qmod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ qfunc preparation_and_application(expectation_value: qbit, psi: qbit[]) {
2828
qfunc main(output expectation_value: qbit) {
2929
psi: qbit[4]; // Target quantum variable, of size 4
3030
allocate(expectation_value); // Ancilla qubit used for the Hadamard test
31-
allocate(4, psi); // Initializes the target state
31+
allocate(psi); // Initializes the target state
3232

3333
preparation_and_application(expectation_value, psi);
3434
drop(psi); // Indicates that the quantum state should not be measured

0 commit comments

Comments
 (0)