-
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
Simplified _Queue
append
#1255
Simplified _Queue
append
#1255
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1255 +/- ##
=======================================
Coverage 99.95% 99.95%
=======================================
Files 72 72
Lines 10454 10454
=======================================
Hits 10449 10449
Misses 5 5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Thanks @stavros11, made them properties once again. |
@property | ||
def moments(self): | ||
moments = [self.nqubits * [None]] | ||
moment_index = self.nqubits * [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.
Before, users had access to moment_index
and now they don't. I don't know if this is the intended behaviour or not.
return len([1 for gate in self if isinstance(gate, gates.M)]) | ||
|
||
@property | ||
def moments(self): |
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.
Both properties are missing docstrings
Co-authored-by: Renato Mello <[email protected]>
This PR removes the
qibo.models.Circuit._Queue.append()
method that was overloading thelist.append()
. The generation of the moments and the calculation of the number of measurements in the circuit is therefore delayed to when it's actually needed. This was mainly motivated by therandom_clifford
function that appends a lot of gates to the circuit, but I believe it is in general useful for speeding up all the functions that make heavily use of theCircuit.add()
method, even though the difference in most cases is probably negligible.Checklist: