generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 161
Open
Description
Describe the feature you'd like
A simple method or tool for counting instructions.
How would this feature be used? Please describe.
Easily used for benchmarking, sanity-checks, or just gathering statistics on a Circuit. Could be an external method Circuit, or preferably a Circuit class method, or an accumulating static property.
A nice parallel is with list.count()
target_circuits.count('cnot')
Describe alternatives you've considered
Like many things, you just manually iterate over instructions and pattern match. Requires knowledge of instruction attributes, and so on. This request is really just a convenience function.
def count_gates(circ)
gates = {}
for ins in circ.instructions:
name = ins.operator.name.lower()
gates[name] = gates.get(name,0) + 1
return gates
Additional context
Could also collect the density of operations.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels