Search Site | Contact Details | FAQ

ADAS Subroutine xxhunt

      SUBROUTINE XXHUNT( XX , N , X , JLO )
C-----------------------------------------------------------------------
C
C  ****************** FORTRAN77 SUBROUTINE: XXHUNT *********************
C
C  PURPOSE: GIVEN AN ARRAY XX(1:N), AND GIVEN A VALUE X, RETURNS A
C           VALUE JLO SUCH THAT X IS BETWEEN XX(JLO) AND XX(JLO+1).
C
C           XX(1:N) MUST BE MONOTONIC, EITHER INCREASING OR 
C           DECREASING. JLO=0 OR JLO=N IS RETURNED TO INDICATE THAT
C           X IS OUT OF RANGE. JLO ON INPUT IS TAKEN AS THE INITIAL
C           GUESS FOR JLO ON OUTPUT.
C
C  REFERENCE:  NUMERICAL RECIPES: The Art of Scientific Computing
C              (FORTRAN Version).
C              W.H.Press, B.P.Flannery, S.A.Teukolsky & W.T.Vetterling.
C              (Cambridge University Press, Cambridge). 1989. p.233
C              ISBN 0 521 38330 7
C
C  CALLING PROGRAM: GENERAL USE
C
C  SUBROUTINE:
C
C  INPUT :    (R*8)  XX      = MONOTONIC INPUT ARRAY
C  INPUT :    (I*4)  N       = INPUT ARRAY 'XX()' LENGTH
C  INPUT :    (R*8)  X       = VALUE WHERE INTERVAL IS TO BE FOUND
C  I/O   :    (I*4)  JLO     = INPUT: INITIAL GUESS FOR INTERVAL INDEX
C                              OUTPU: RETURNED INTERVAL INDEX
C
C             (I*4)  INC     = HUNT INCREMENT
C             (I*4)  JHI     = UPPER BOUND FOR BRACKETING X
C             (I*4)  JM      = MEAN OF JLO AND JHI
C
C             (L*4)  ASCND   = .TRUE. FOR ASCENDING VALUES IN XX,
C                              .FALSE. FOR DESCENDING VALUES
C
C ROUTINES:  NONE
C
C NOTE:
C
C AUTHOR:  LORNE D. HORTON (IPP GARCHING)
C          L5.213
C          IPP EXT. 1635
C
C DATE:    19/03/03
C
C VERSION:  1.1                         DATE: 19/03/03
C MODIFIED: Lorne Horton
C           - Initial version
C
C UPDATE:   1.2                         DATE: 17/05/07
C MODIFIED: Allan Whiteford
C           - Updated comments as part of subroutine documentation
C             procedure.
C-----------------------------------------------------------------------
C
C-----------------------------------------------------------------------
      INTEGER             JLO,         N
      REAL*8              X,           XX(N)
© Copyright 1995-2024 The ADAS Project
Comments and questions to: adas-at-adas.ac.uk