QPot 0.12.2.dev1+g4043351
|
Function to find items in an increase range, and to store this range in chunks. More...
Functions | |
std::string | version () |
Return version string, e.g. More... | |
std::vector< std::string > | version_dependencies () |
Return versions of this library and of all of its dependencies. More... | |
template<class T , class V , class R > | |
R | lower_bound (const T &matrix, const V &value, const R &index, size_t proximity=10) |
Iterating on the last axis of an nd-array (e.g. More... | |
template<class T , class V , class R > | |
R | lower_bound (const T &matrix, const V &value) |
Iterating on the last axis of an nd-array (e.g. More... | |
template<class V , class I > | |
V | cumsum_chunk (const V &cumsum, const V &delta, const I &shift) |
Update the chunk of a cumsum computed and stored in chunks. More... | |
Function to find items in an increase range, and to store this range in chunks.
|
inline |
Update the chunk of a cumsum computed and stored in chunks.
Consider a full array:
da = np.random.random(N) a = np.cumsum(a)
With chunk settings:
n = ... # size of each new chunk nbuffer = ... # number of items to buffer
The the first chunk:
chunk = np.copy(a[:n + nbuffer]) nchunk = n + nbuffer istart = np.array(0)
Then, moving right:
QPot.cumsum_chunk_inplace(chunk, da[istart + nchunk : istart + nchunk + n], n) istart += n
Or, moving left:
QPot.cumsum_chunk_inplace(chunk, da[istart - n : istart + 1], -n) istart -= n
cumsum | The current chunk of the cumsum. |
delta | The 'diff's of the next chunk in the cumsum. |
shift | The shift per row. |
cumsum
.
|
inline |
Iterating on the last axis of an nd-array (e.g.
per row of a rank 2 matrix): Return index of the first element in the range [first, last) such that element < value
is false
(i.e. greater or equal to), or last if no such element is found.
matrix | The matrix defining a range per row. |
value | The value to find (per row). |
value
.
|
inline |
Iterating on the last axis of an nd-array (e.g.
per row of a rank 2 matrix): Return index of the first element in the range [first, last) such that element < value
is false
(i.e. greater or equal to), or last if no such element is found.
This function allows for a guess of the index and a proximity search around. This could be efficient for finding items in large arrays.
matrix | The matrix defining a range per row. |
value | The value to find (per row). |
index | Initial guess on index . |
proximity | Size of the proximity search around guess (use 0 to disable proximity search). |
index
.
|
inline |