-
Notifications
You must be signed in to change notification settings - Fork 37
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
Add random circuit algo #139
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #139 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 26 29 +3
Lines 1028 1053 +25
Branches 181 185 +4
=========================================
+ Hits 1028 1053 +25 ☔ View full report in Codecov by Sentry. |
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.
Added a few comments. Overall I am not sure that the current implementation is actually useful for anything.
Also, I believe these two comments from the original PR still apply:
src/braket/experimental/algorithms/random_circuit/random_circuit.py
Outdated
Show resolved
Hide resolved
# Get the constructor's signature to determine required parameters | ||
init_signature = inspect.signature(gate_class.__init__) | ||
|
||
# Calculate the number of parameters (excluding 'self') | ||
num_params = len(init_signature.parameters) - 1 |
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.
This seems like it should work for now, but in case these constructors get more args added in the future, it is likely more robust to check the actual class ... something like:
num_params = (
3 if issubclass(gate_class, TripleAngledGate) else
2 if issubclass(gate_class, DoubleAngledGate) else
1 if issubclass(gate_class, AngledGate) else
0
)
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.
Braket SDK doesn't have DoubleAngled or TripleAngled classes, unfortunately. The existing code should work fine.
src/braket/experimental/algorithms/random_circuit/random_circuit.md
Outdated
Show resolved
Hide resolved
src/braket/experimental/algorithms/random_circuit/random_circuit.py
Outdated
Show resolved
Hide resolved
src/braket/experimental/algorithms/random_circuit/random_circuit.py
Outdated
Show resolved
Hide resolved
src/braket/experimental/algorithms/random_circuit/random_circuit.py
Outdated
Show resolved
Hide resolved
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.
Looking good! A few more minor comments, nothing too critical.
Also note that #140 is adding a summary table to the README - if that gets merged first, then a link to this random_circuit function should probably also be added to that summary table.
Description of changes:
Added random circuit generator, that takes the number of qubits, number of gates and maximum number of operands for each gate as an input.
This PR reimplements the feature proposed in #122
by @Morcu, created in a fork repo.
Merge Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.General
Tests
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.