QECGatesCost#

qualtran.resource_counting.QECGatesCost

Counts specifically for ‘expensive’ gates in a surface code error correction scheme.

Inherits From: CostKey

The cost value type for this CostKey is GateCounts.

legacy_shims

If enabled, modify the counting logic to match the peculiarities of the legacy t_complexity protocol.

legacy_shims

 

Methods#

compute

View source

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

bloq

The bloq to compute the cost of.

get_callee_cost

A 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

View source

The value corresponding to zero cost.

validate_val

View source

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__

Check equality and either forward a NotImplemented or return the result negated.

__eq__

Method generated by attrs for class QECGatesCost.