get_cost_value#
View source on GitHub
|
Compute the specified cost of the provided bloq.
qualtran.resource_counting.get_cost_value(
bloq: 'Bloq',
cost_key: CostKey[CostValT],
costs_cache: Optional[Dict['Bloq', CostValT]] = None,
generalizer: Optional[Union['GeneralizerT', Sequence['GeneralizerT']]] = None
) -> qualtran.resource_counting.CostValT
Args
bloqThe bloq to compute the cost of.
cost_keyA CostKey that specifies which cost to compute.
costs_cacheIf provided, use this dictionary of cached cost values. Values in this dictionary will be preferred over computed values (even if they disagree). This dictionary will be mutated by the function.
generalizerIf provided, run this function on each bloq in the call graph to dynamically modify attributes. If the function returns
None, the bloq is ignored in the cost computation. If a sequence of generalizers is provided, each generalizer will be run in order.
View source on GitHub