C******************** START FILE LARCMP.FOR ; GROUP UFILES ******************
C-------------------------------------------------------------
C  LARCMP
C  COMPARE TWO REAL ARRAYS
C  RETURN .TRUE. IF THEY ARE THE SAME WITHIN TOLERANCES:
C   ZABS- ABSOLUTE TOLERANCE
C     COMPARE WITH ABS(X1(J)-X2(J))
C   ZREL- RELATIVE TOLERANCE
C    COMPARE TO ABS( (X1(J)-X2(J))/(.5*(X1(J)+X2(J))) )
C
C  NOTE ZABS IN UNITS OF X; ZREL A DIMENSIONLESS FRACTION
C
C  OUTPUT POINTER IPT POINTS OUT LOCATION OF PROBLEM
C   IPT=0 INDICATES ARRAYS HAVE DIFFERENT SIZES
C
      LOGICAL FUNCTION LARCMP(X1,NX1,X2,NX2,ZABS,ZREL,IPT)
C
      DIMENSION X1(NX1),X2(NX2)
C
c$r8real_input: x1,x2,zabs,zrel
C
      LARCMP=.FALSE.
      IPT=0
      IF(NX1.NE.NX2) RETURN
      IF(NX1.LE.0) RETURN
C
      DO 10 I=1,NX1
      IPT=I
      ZDIV=ABS(X1(I)-X2(I))
      IF(ZDIV.LE.ZABS) GO TO 10
C  POINT MUST DIVERGE BY BOTH CRITERIA TO BE CONSIDERED DIVERGANT
      ZAVG=.5*ABS(X1(I)+X2(I))
      IF(ZAVG.EQ.0.0) RETURN
      IF(ZREL.LT.(ZDIV/ZAVG)) RETURN
 10   CONTINUE
C
      LARCMP=.TRUE.
      RETURN
      	END
C******************** END FILE LARCMP.FOR ; GROUP UFILES ******************
