| 1 | C |
| 2 | C Copyright (c) 1995 Eric Gourgoulhon |
| 3 | C |
| 4 | C This file is part of LORENE. |
| 5 | C |
| 6 | C LORENE is free software; you can redistribute it and/or modify |
| 7 | C it under the terms of the GNU General Public License as published by |
| 8 | C the Free Software Foundation; either version 2 of the License, or |
| 9 | C (at your option) any later version. |
| 10 | C |
| 11 | C LORENE is distributed in the hope that it will be useful, |
| 12 | C but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | C GNU General Public License for more details. |
| 15 | C |
| 16 | C You should have received a copy of the GNU General Public License |
| 17 | C along with LORENE; if not, write to the Free Software |
| 18 | C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | C |
| 20 | C |
| 21 | C |
| 22 | C $Id: huntm.f,v 1.2 2012/03/30 12:12:42 j_novak Exp $ |
| 23 | C $Log: huntm.f,v $ |
| 24 | C Revision 1.2 2012/03/30 12:12:42 j_novak |
| 25 | C Cleaning of fortran files |
| 26 | C |
| 27 | C Revision 1.1.1.1 2001/11/20 15:19:30 e_gourgoulhon |
| 28 | C LORENE |
| 29 | C |
| 30 | c Revision 1.1 2000/11/28 13:53:50 nbib |
| 31 | c Initial revision |
| 32 | c |
| 33 | C |
| 34 | C $Header: /cvsroot/Lorene/F77/Source/huntm.f,v 1.2 2012/03/30 12:12:42 j_novak Exp $ |
| 35 | C |
| 36 | C |
| 37 | SUBROUTINE HUNTM(XX,N,X,JLO) |
| 38 | C version du 19.06.1995 |
| 39 | C d'apres la routine HUNT de Numerical Recepies. |
| 40 | C****************************************************************************** |
| 41 | |
| 42 | IMPLICIT double PRECISION (A-H,O-Z) |
| 43 | |
| 44 | character*120 header |
| 45 | data header/'$Header: /cvsroot/Lorene/F77/Source/huntm.f,v 1.2 2012/03/30 12:12:42 j_novak Exp $'/ |
| 46 | |
| 47 | DIMENSION XX(N) |
| 48 | LOGICAL ASCND |
| 49 | ASCND=XX(N).GT.XX(1) |
| 50 | IF(JLO.LE.0.OR.JLO.GT.N)THEN |
| 51 | JLO=0 |
| 52 | JHI=N+1 |
| 53 | GO TO 3 |
| 54 | ENDIF |
| 55 | INC=1 |
| 56 | IF(X.GE.XX(JLO).EQV.ASCND)THEN |
| 57 | 1 JHI=JLO+INC |
| 58 | IF(JHI.GT.N)THEN |
| 59 | JHI=N+1 |
| 60 | ELSE IF(X.GE.XX(JHI).EQV.ASCND)THEN |
| 61 | JLO=JHI |
| 62 | INC=INC+INC |
| 63 | GO TO 1 |
| 64 | ENDIF |
| 65 | ELSE |
| 66 | JHI=JLO |
| 67 | 2 JLO=JHI-INC |
| 68 | IF(JLO.LT.1)THEN |
| 69 | JLO=0 |
| 70 | ELSE IF(X.LT.XX(JLO).EQV.ASCND)THEN |
| 71 | JHI=JLO |
| 72 | INC=INC+INC |
| 73 | GO TO 2 |
| 74 | ENDIF |
| 75 | ENDIF |
| 76 | 3 IF(JHI-JLO.EQ.1)RETURN |
| 77 | JM=(JHI+JLO)/2 |
| 78 | IF(X.GT.XX(JM).EQV.ASCND)THEN |
| 79 | JLO=JM |
| 80 | ELSE |
| 81 | JHI=JM |
| 82 | ENDIF |
| 83 | GO TO 3 |
| 84 | END |