-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples grover #389
Examples grover #389
Conversation
renaming cma function
removing undesired prints
Codecov Report
@@ Coverage Diff @@
## grovermodel #389 +/- ##
=============================================
Coverage 100.00% 100.00%
=============================================
Files 79 80 +1
Lines 12689 12731 +42
=============================================
+ Hits 12689 12731 +42
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@AdrianPerezSalinas thanks for this. I have noticed that the sphinx documentation is not rendering properly, could you please have a look? |
examples/grover/README.md
Outdated
@@ -0,0 +1,123 @@ | |||
# A General Grover Model | |||
|
|||
This examples provide information to run a general Grover model accesible as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These / or better "The examples presented here..."
examples/grover/README.md
Outdated
|
||
- oracle (`qibo.core.circuit.Circuit`): quantum circuit that flips | ||
the sign using a Grover ancilla initialized with -X-H-. Grover ancilla | ||
expected to be last qubit of oracle circuit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the last?
examples/grover/README.md
Outdated
The found bitstring not included. | ||
- iterative (bool): force the use of the iterative Grover | ||
|
||
We provide three different examples to run Grover with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with:
examples/grover/README.md
Outdated
In this first example we show how to use a standard Grover search where the | ||
search space is an equally weighted superposition of quantum states and the oracle | ||
is simply defined through a layer of Hadamard gates. This example makes no use of | ||
ancilla qubits, so the syntaxis simplifies greatly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the syntax, or the command lines / function calls?
examples/grover/README.md
Outdated
|
||
### Example 3: Ancillas for superposition and oracle, setting size of search space | ||
|
||
In this third example we create a Grover model with two components |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
components:
examples/grover/example_1.py
Outdated
@@ -0,0 +1,21 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove empty line
examples/grover/example_1.py
Outdated
solution, iterations = grover() | ||
|
||
print('The solution is', solution) | ||
print('Number of iterations needed:', iterations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add empty line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this implementation, I have included some comments above, in general however would be great if you could convert the file to PEP8 convetion and include these files in test_examples.py
.
fixing hep import in sphinx
Test that code does not contain `print` statements
Hi @scarrazza , I think everything is fixed now, please let me know if there is anything wrong |
examples/grover/1/main.py
Outdated
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--qubits", default=5, type=int) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AdrianPerezSalinas this example is not working for me, it crashes at line 20.
Could you please rename qubits
in nqubits
in order to match the syntax of other examples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the problem come from this mismatch? I have tested it and it works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the test_examples.py
file run? I cannot see it clearly and I think here is where the problem lies
@@ -0,0 +1,123 @@ | |||
# A General Grover Model | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include a reference link to the code, as we do in all tutorials.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me suggest to move the examples to:
- example1.py
- example2.py
- example3.py
Merging over
grovermodel