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.
countextendExtend the right side of the deque with elements from the iterable
extendleftExtend the left side of the deque with elements from the iterable
indexRaises ValueError if the value is not present.
insertD.insert(index, object) -- insert object before index
popRemove and return the rightmost element.
popleftRemove and return the leftmost element.
removeD.remove(value) -- remove first occurrence of value.
reverseD.reverse() -- reverse IN PLACE
rotateRotate the deque n steps to the right (default n=1).
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