next up previous contents index
Next: Function average_array Up: Module linearalgebra_module Previous: Function is_in_array   Contents   Index

Function binary_search


\begin{boxedminipage}{\textwidth}
\begin{verbatim}index = binary_search(array,value[,first,low, &
high])\end{verbatim}
\end{boxedminipage}

Do binary search and return index of element containing value, or zero if not found. array must be sorted into ascending order beforehand. If the array subscripts dont start at 1, then pass the actual index of the first element as first', then, if the element isnt found, the value returned is first' minus 1. To restrict the search to a subsection of the array supply low and/or high.

array -- integer, dimension(:), intent(in)

value -- integer, intent(in)

first, low, high -- integer, optional, intent(in)

Return value -- integer

average_array function

gabor 2009-06-30