qimpy.algorithms.ConvergenceCheck
- class ConvergenceCheck(threshold, n_check=2)
Bases:
Deque[bool]Check quantity stays unchanged a certain number of times.
- Parameters:
threshold (float)
n_check (int)
- __init__(threshold, n_check=2)
Initialize convergence check to specified threshold. The check must pass n_check consecutive times.
- Parameters:
threshold (float)
n_check (int)
- Return type:
None
Methods
Initialize convergence check to specified threshold.
appendAdd an element to the right side of the deque.
appendleftAdd an element to the left side of the deque.
Return if converged, given latest quantity v to check.
clearRemove all elements from the deque.
copyReturn a shallow copy of a deque.
countReturn number of occurrences of value.
extendExtend the right side of the deque with elements from the iterable.
extendleftExtend the left side of the deque with elements from the iterable.
indexReturn first index of value.
insertInsert value before index.
popRemove and return the rightmost element.
popleftRemove and return the leftmost element.
removeRemove first occurrence of value.
reverseReverse IN PLACE.
rotateRotate the deque n steps to the right.
Attributes
maxlenmaximum size of a deque or None if unbounded
Convergence threshold
Number of consecutive checks that must pass at convergence
- check(v)
Return if converged, given latest quantity v to check.
- Parameters:
v (float)
- Return type:
bool
- n_check: int
Number of consecutive checks that must pass at convergence
- threshold: float
Convergence threshold