Skip to content

Commit

Permalink
Minor examples fix
Browse files Browse the repository at this point in the history
  • Loading branch information
davidedellagiustina committed Feb 10, 2024
1 parent 7884d56 commit 0095cf2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/examples/quantum_counting.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@ def main():
pause()

# Simulation
m = math.ceil(n/2)
m = math.ceil(n/2) + 1
eps = 1/6
# pylint: disable=invalid-name
(circuit, _, M) = qasp.problems.estimation.exec_count(algorithm, oracle, m, eps)
print(f'Used circuit:\n{tab(str(circuit.draw()))}\n')
pause()
print(
f'Estimated number of solutions: {M.lower:.2f} <= M <= {M.upper:.2f}.')
f'Estimated number of solutions: {M.lower:.2f} <{"" if M.left else "="} M',
f'<{"" if M.right else "="} {M.upper:.2f}.'
)
print()


Expand Down
4 changes: 3 additions & 1 deletion src/examples/quantum_counting_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def main():
print(f'Used circuit:\n{tab(str(circuit.draw()))}\n')
pause()
print(
f'Estimated number of solutions: {M.lower:.2f} <= M <= {M.upper:.2f}.')
f'Estimated number of solutions: {M.lower:.2f} <{"" if M.left else "="} M',
f'<{"" if M.right else "="} {M.upper:.2f}.'
)
print()


Expand Down
4 changes: 3 additions & 1 deletion src/examples/quantum_faceted_navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def main():
print(f'Used circuit:\n{tab(str(circuit.draw()))}\n')
pause()
print(
f'Estimated number of solutions: {M.lower:.2f} <= M <= {M.upper:.2f}.')
f'Estimated number of solutions: {M.lower:.2f} <{"" if M.left else "="} M',
f'<{"" if M.right else "="} {M.upper:.2f}.'
)
print()


Expand Down

0 comments on commit 0095cf2

Please sign in to comment.