QECGatesCost#
qualtran.resource_counting.QECGatesCost
View source on GitHub
|
Counts specifically for ‘expensive’ gates in a surface code error correction scheme.
Inherits From: CostKey
qualtran.resource_counting.QECGatesCost(
*, legacy_shims=attr_dict['legacy_shims'].default
)
The cost value type for this CostKey is GateCounts.
Args
legacy_shimsIf enabled, modify the counting logic to match the peculiarities of the legacy
t_complexityprotocol.
Attributes
Methods#
compute
compute(
bloq: 'Bloq', get_callee_cost: Callable[['Bloq'], GateCounts]
) -> qualtran.resource_counting.GateCounts
Compute this type of cost.
When implementing a new CostKey, this method must be overridden.
Users should not call this method directly. Instead: use the qualtran.resource_counting
functions like get_cost_value, get_cost_cache, or query_costs. These provide
caching, logging, generalizers, and support for static costs.
For recursive computations, use the provided callable to recurse.
Args
bloqThe bloq to compute the cost of.
get_callee_costA qualtran-provided function for computing costs for “callees” of the bloq; i.e. bloqs in the decomposition. Use this function to accurately cache intermediate cost values and respect bloqs’ static costs.
Returns
zero
zero() -> qualtran.resource_counting.GateCounts
The value corresponding to zero cost.
validate_val
validate_val(
val: qualtran.resource_counting.GateCounts
)
Assert that val is a valid CostValT.
This method can be optionally overridden to raise an error if an invalid value is encountered. By default, no validation is performed.
__ne__
__ne__(
other
)
Check equality and either forward a NotImplemented or return the result negated.
__eq__
__eq__(
other
)
Method generated by attrs for class QECGatesCost.
View source on GitHub