Delegate DirectILKernelGenerator.SearchSortedKernel
SearchSorted kernel delegate.
public delegate long DirectILKernelGenerator.SearchSortedKernel(void* arrPtr, long arrLen, long arrStrideBytes, void* keyPtr, long keyLen, void* sorterPtr, long* retPtr)
Parameters
arrPtrvoid*Pointer to a's data, already at a.Shape.offset.
arrLenlongNumber of elements in a.
arrStrideByteslonga's stride in bytes (= elemSize when contiguous).
keyPtrvoid*Pointer to v's data; v MUST be contiguous (elemSize stride implicit). Not read when
keyLenis 0.keyLenlongNumber of elements in v; 0 is legal (only the sorter's middle entry is checked).
sorterPtrvoid*Pointer to int64 sorter array (contiguous), or null for no sorter.
retPtrlong*Output int64* (contiguous, keyLen elements). It also holds each key's running base between the bisection's passes, so it must not alias the keys or the haystack.
Returns
- long
0 when every key was searched; -1 (NumPy's argbinsearch) when the bisection reached a sorter entry outside
[0, arrLen): the search stops there, before that entry addressesarrPtr, and the caller raises NumPy'sValueError: Sorter index out of range.(the bases already written are discarded with the result, as NumPy's are). The middle entry is reached before any key, so -1 can come with no key at all. Always 0 without a sorter.