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.
append
Add an element to the right side of the deque.
appendleft
Add an element to the left side of the deque.
Return if converged, given latest quantity v to check.
clear
Remove all elements from the deque.
copy
Return a shallow copy of a deque.
count
D.count(value) -- return number of occurrences of value
extend
Extend the right side of the deque with elements from the iterable
extendleft
Extend the left side of the deque with elements from the iterable
index
D.index(value, [start, [stop]]) -- return first index of value.
insert
D.insert(index, object) -- insert object before index
pop
Remove and return the rightmost element.
popleft
Remove and return the leftmost element.
remove
D.remove(value) -- remove first occurrence of value.
reverse
D.reverse() -- reverse IN PLACE
rotate
Rotate the deque n steps to the right (default n=1).
Attributes
maxlen
maximum 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