|
Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.stsci.edu/~sontag/spicedocs/cspice/bsrchi_c.html
Дата изменения: Sat Dec 17 06:08:32 2005 Дата индексирования: Sun Apr 10 23:57:50 2016 Кодировка: Поисковые слова: http www.badastronomy.com phpbb index.php |
Do a binary search for a key value within an integer array, assumed to be in increasing order. Return the index of the matching array entry, or -1 if the key value is not found.
None.
VARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- value I Value to find in array. ndim I Dimension of array. array I Array to be searched. The function returns the index of the input key value in the input array, or -1 if the value is not found.
value is the value to be found in the input array.
ndim is the number of elements in the input array.
array is the array to be searched. The elements in the
array are assumed to sorted in increasing order.
The function returns the index of the input value in the input array. Indices range from zero to ndim-1. If the input array does not contain the specified value, the function returns -1. If the input array contains more than one occurrence of the specified value, the returned index may point to any of the occurrences.
None.
A binary search is performed on the input array. If an element of the array is found to match the input value, the index of that element is returned. If no matching element is found, -1 is returned.
Let array contain the following elements:
-11
0
22
750
Then
bsrchi_c ( -11, 4, array ) == 0
bsrchi_c ( 22, 4, array ) == 2
bsrchi_c ( 751, 4, array ) == -1
array is assumed to be sorted in increasing order. If this condition is not met, the results of bsrchi_c are unpredictable.
Error free. If ndim < 1 the value of the function is -1.
None.
N.J. Bachman (JPL) I.M. Underwood (JPL)
None.
-CSPICE Version 1.0.0, 30-AUG-2002 (NJB) (IMU)
binary search for an integer value