



      REAL FUNCTION GVFACS(ARGMNT)












      IMPLICIT      NONE
      REAL          ARGMNT





      IF (ARGMNT.GE.1.0) THEN
         GVFACS=ACOS(1.0)
      ELSE IF (ARGMNT.LE.-1.0) THEN
         GVFACS=ACOS(-1.0)
      ELSE
         GVFACS=ACOS(ARGMNT)
      END IF





      RETURN
      END
      REAL FUNCTION GVFCOS(ARGMNT)











      IMPLICIT      NONE
      REAL          ARGMNT





      GVFCOS=COS(ARGMNT)





      RETURN
      END
      REAL FUNCTION GVFSIN(ARGMNT)











      IMPLICIT      NONE
      REAL          ARGMNT





      GVFSIN=SIN(ARGMNT)





      RETURN
      END
      REAL FUNCTION GVFSQR(ARGMNT)










      IMPLICIT      NONE
      REAL          ARGMNT





      IF (ARGMNT.LT.1.E-20) THEN
         GVFSQR=0.0
      ELSE
         GVFSQR=SQRT(ARGMNT)
      END IF





      RETURN
      END
      REAL FUNCTION GVFDTR(ANGLE)







      IMPLICIT      NONE
      REAL          ANGLE





      GVFDTR=ANGLE*ATAN(1.0)/45.0





      RETURN
      END
      REAL FUNCTION GVFRTD(ANGLE)







      IMPLICIT      NONE
      REAL          ANGLE





      GVFRTD=ANGLE*45.0/ATAN(1.0)





      RETURN
      END
      INTEGER FUNCTION GVFIAN(VALLOW,VALHGH)












      IMPLICIT      NONE
      INTEGER       VALLOW, VALHGH, VLLLOW, VLLHGH, VALTMP
      REAL          ARANDM, GVFRND







      VLLLOW=VALLOW
      VLLHGH=VALHGH
      IF (VLLLOW.GT.VLLHGH) CALL GVSWIP (VLLLOW,VLLHGH)
      IF (VLLHGH-VLLLOW.LT.1) THEN
         GVFIAN=VLLLOW
         GOTO 998
      END IF



      ARANDM=GVFRND(0)



      VALTMP=VLLLOW+INT(ARANDM*FLOAT(VLLHGH-VLLLOW+1))
      GVFIAN=MIN(VALHGH,MAX(VALTMP,VALLOW))



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION GVFIN0(IROW,NUM)
















      IMPLICIT      NONE
      INTEGER       NUM, IROW(NUM), I







      GVFIN0=0



      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            IF (IROW(I).NE.0) GVFIN0=GVFIN0+1
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSB50')
         CALL GVSKIL
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSB49',NUM)
         CALL GVSKIL
      END IF



  998 CONTINUE


      RETURN
      END
      REAL FUNCTION GVFRN0(ROW,NUM)
















      IMPLICIT      NONE
      INTEGER       NUM, I
      REAL          ROW(NUM)







      GVFRN0=0.0



      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            IF (ABS(ROW(I)).GT.0.000001) GVFRN0=GVFRN0+1.0
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSB52')
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSB49',NUM)
      END IF



  998 CONTINUE


      RETURN
      END
      REAL FUNCTION GVFRNC(ROW,CUTOFF,NUM)
















      IMPLICIT      NONE
      INTEGER       NUM, I
      REAL          ROW(NUM), CUTOFF







      GVFRNC=0.0



      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            IF (ABS(ROW(I)).GT.CUTOFF) GVFRNC=GVFRNC+1.0
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSB52')
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSB49',NUM)
      END IF



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION GVFIRG(ICON1,ICON2,ICON3)














      IMPLICIT      NONE
      LOGICAL       GVFIBN
      INTEGER       ICON1, ICON2, ICON3







      IF (GVFIBN(ICON1,ICON2,ICON3)) THEN
         GVFIRG=ICON1
         GOTO 998
      ELSE



         IF (ICON2.GT.ICON3) THEN



            IF (ICON1.GT.ICON2) THEN
               GVFIRG=ICON2
            ELSE
               GVFIRG=ICON3
            END IF
         ELSE



            IF (ICON1.LT.ICON2) THEN
               GVFIRG=ICON2
            ELSE
               GVFIRG=ICON3
            END IF
         END IF
      END IF



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION GVFISM(IVEC,NUM)















      IMPLICIT      NONE
      INTEGER       NUM, I
      INTEGER       IVEC(NUM)







      GVFISM=0



      IF (NUM.GT.0) THEN
         DO 10 I=1,NUM
            GVFISM=GVFISM+IVEC(I)
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSB52')
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSB53',NUM)
      END IF



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION GVFFIP(IROW,ICON,NUM)

















      IMPLICIT      NONE
      INTEGER       NUM
      INTEGER       IROW(NUM), ICON, I





      GVFFIP=0



      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            IF (ICON.EQ.IROW(I)) THEN
               GVFFIP=I
               GOTO 998
            END IF
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTT6 ('?TLSB44')
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSB43',NUM)
      END IF



  998 CONTINUE


      RETURN
      END
      REAL FUNCTION GVFMPI(FACTOR)







      IMPLICIT      NONE
      REAL          FACTOR





      GVFMPI=FACTOR*3.141593





      RETURN
      END
      REAL FUNCTION GVFMX2(ROW,WORK,NTH,NUM)
















      IMPLICIT      NONE
      INTEGER       NTH, NUM
      REAL          ROW(NUM), WORK(NUM)







      GVFMX2=0.0



      IF (NUM.GT.0) THEN



         CALL GVSCPR (WORK,ROW,NUM)
         CALL GVSRT1 (WORK,NUM)
         GVFMX2=WORK(NUM-NTH+1)
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSB61')
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSB60',NUM)
      END IF



  998 CONTINUE


      RETURN
      END
      REAL FUNCTION GVFRAN(VALLOW,VALHGH)












      IMPLICIT      NONE
      REAL          VALLOW, VALHGH, VLLLOW, VLLHGH, ARANDM,
     +              GVFRND







      VLLLOW=VALLOW
      VLLHGH=VALHGH
      IF (VLLLOW.GT.VLLHGH) CALL GVSWAP (VLLLOW,VLLHGH)
      IF (VLLHGH-VLLLOW.LT.0.000001) THEN
         GVFRAN=VLLHGH
         GOTO 998
      END IF



      ARANDM=GVFRND(0)



      GVFRAN=VLLLOW+ARANDM*(VLLHGH-VLLLOW)



  998 CONTINUE


      RETURN
      END
      REAL FUNCTION GVFRND(IDUM)







      IMPLICIT      NONE
      INTEGER       M1, M2, M3, IA1, IA2, IA3, IC1, IC2, IC3,
     +              J, IFF, IX1, IX2, IX3, IDUM, IROW(6)
      REAL          R(97),RM1,RM2
      PARAMETER     (M1=2592)
      PARAMETER     (IA1=7141)
      PARAMETER     (IC1=54773)
      PARAMETER     (RM1=0.0003858024)
      PARAMETER     (M2=134456)
      PARAMETER     (IA2=8121)
      PARAMETER     (IC2=28411)
      PARAMETER     (RM2=0.000007437377)
      PARAMETER     (M3=243000)
      PARAMETER     (IA3=4561)
      PARAMETER     (IC3=51349)
      SAVE          IFF, IX1, IX2, IX3, R
      DATA IFF      /0/







      IF (IFF.EQ.0.OR.IDUM.NE.0) THEN



         IF (IDUM.EQ.0) THEN
            CALL GVSIT0 (IROW,6)
         ELSE
            CALL GVSTII (IROW)
         END IF
         IFF=1
         IX1=MOD(IC1-IDUM+IROW(1)+IROW(6),M1)
         IX1=MOD(IA1*IX1+IC1+IROW(2),M1)
         IX2=MOD(IX1+IROW(3),M2)
         IX1=MOD(IA1*IX1+IC1,M1)
         IX3=MOD(IX1+IROW(4),M3)
         DO 11 J=1,97
            IX1=MOD(IA1*IX1+IC1+IROW(5),M1)
            IX2=MOD(IA2*IX2+IC2+IROW(6),M2)
            R(J)=(FLOAT(IX1)+FLOAT(IX2)*RM2)*RM1
 11      CONTINUE
      END IF



      IX1=MOD(IA1*IX1+IC1,M1)
      IX2=MOD(IA2*IX2+IC2,M2)
      IX3=MOD(IA3*IX3+IC3,M3)
      J=1+(97*IX3)/M3
      IF (J.GT.97.OR.J.LT.1) THEN
         CALL GVSTTB ('?M3025')
         CALL GVSTTI ('?M3026',J)
      END IF
      GVFRND=R(J)
      R(J)=(FLOAT(IX1)+FLOAT(IX2)*RM2)*RM1





      RETURN
      END
      SUBROUTINE GVSTII (IROW)

















      IMPLICIT      NONE
      INTEGER       IROW(6), I, GVFLFI
      CHARACTER*10  DATESTR, LOC1
      CHARACTER*8   TIMESTR, LOC2







      CALL GVSIT0 (IROW,6)




         LOC1=DATESTR()
         LOC2=TIMESTR()
         I=GVFLFI(3,IROW(1),LOC1)
         I=GVFLFI(3,IROW(4),LOC2)






      RETURN
      END
      INTEGER FUNCTION GVFIRN(LIMIT)









      IMPLICIT      NONE
      INTEGER       LIMIT, ITMP
      REAL          TMP, GVFRND





      IF (LIMIT.LE.0) THEN
         CALL GVSTTB ('?NEWB250')
         GVFIRN=0
         GOTO 998
      END IF
 10   CONTINUE
      TMP=GVFRND(0)
      ITMP=INT(TMP*FLOAT(LIMIT))
      IF (ITMP.EQ.LIMIT) GOTO 10
      GVFIRN=ITMP



  998 CONTINUE


      RETURN
      END
      REAL FUNCTION GVFRNG(CON1,CON2,CON3)












      IMPLICIT      NONE
      REAL          CON1, CON2, CON3
      LOGICAL       GVFRIN







      IF (GVFRIN(CON1,CON2,CON3)) THEN
         GVFRNG=CON1
         GOTO 998
      ELSE



         IF (CON2.GT.CON3) THEN



            IF (CON1.GT.CON2) THEN
               GVFRNG=CON2
            ELSE
               GVFRNG=CON3
            END IF
         ELSE



            IF (CON1.LT.CON2) THEN
               GVFRNG=CON2
            ELSE
               GVFRNG=CON3
            END IF
         END IF
      END IF



  998 CONTINUE


      RETURN
      END
      REAL FUNCTION GVFRSM(ROW,NUM)












      IMPLICIT      NONE
      INTEGER       NUM, I
      REAL          ROW(NUM)





      GVFRSM=0.0
      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            GVFRSM=GVFRSM+ROW(I)
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSB64')
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSB63',NUM)
      END IF



  998 CONTINUE


      RETURN
      END
      REAL FUNCTION GVFWGT(SEQ)
































      IMPLICIT      NONE
      CHARACTER     SEQ*1
      CHARACTER     NAMES*23
      PARAMETER     (NAMES='ACDEFGHIKLMNPQRSTVWYBZ-')
      REAL          W(24)
      DATA       W /128.16,89.09,121.15,133.10,147.13,165.19,75.07,
     +              155.16,131.17,146.19,131.17,149.21,132.12,115.13,
     +              146.15,174.20,105.09,119.12,117.15,204.23,181.19,
     +              132.61,146.64,18.015/







      GVFWGT=W(INDEX(NAMES,SEQ)+1)





      RETURN
      END
      SUBROUTINE GVSBTF (BROW,NUM)













      IMPLICIT      NONE
      INTEGER       NUM, I
      LOGICAL       BROW(NUM)





      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            BROW(I) = .FALSE.
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSB71')
         CALL GVSKIL
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSB70',NUM)
         CALL GVSKIL
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSBTT (BROW,NUM)













      IMPLICIT      NONE
      INTEGER       NUM, I
      LOGICAL       BROW(NUM)





      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            BROW(I) = .TRUE.
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSB71T')
         CALL GVSKIL
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSB70T',NUM)
         CALL GVSKIL
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSCOD (TEXT)








      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, GVFLEN
      LOGICAL       GVFFOP, wsvfop
      CHARACTER*1   CDUMMY
      CHARACTER*80  LOCTXT
      CHARACTER*(*) TEXT









      IF (WIFPAR(1012).EQ.0) GOTO 998
      IF (WIFPAR(1105).EQ.1) GOTO 998
      IF (GVFFOP(IU54)) GOTO 998
      IF (WSVFOP()) GOTO 998



      IF (GVFLEN(TEXT).LE.0) THEN
         CALL GVSSTX (LOCTXT,'?TLSCOD')
      ELSE
         CALL GVSCCC (LOCTXT,TEXT,'?TLSCOD')
      END IF
      CALL IPROMPT (LOCTXT)
      CALL GETWORD (CDUMMY,IERR)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSCODA (TEXT)








      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       GVFLEN
      LOGICAL       WSVFOP
      CHARACTER*(*) TEXT







      IF (WIFPAR(1105).NE.0) GOTO 998
      IF (WSVFOP()) GOTO 998



      IF (GVFLEN(TEXT).GT.0) THEN
         CALL GVSTT6 (TEXT)
      END IF



      CALL GVSTO6 ('?M3027')
      CALL GVSFMT ('?FMT283')
      READ (5,FMT,ERR=998)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSCPS (ROW,BROW,NUM,NEWNUM)
































      IMPLICIT      NONE
      INTEGER       NUM, NEWNUM, I
      REAL          ROW(NUM)
      LOGICAL       BROW(NUM)







      NEWNUM=0

      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            IF (BROW(I)) THEN
               NEWNUM=NEWNUM+1
               ROW(NEWNUM)=ROW(I)
            END IF
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSD07')
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSD08',NUM)
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSCTC (CROW,CHAR,NUM)














      IMPLICIT      NONE
      INTEGER       NUM, I
      CHARACTER*1   CROW(NUM), CHAR





      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            CROW(I) = CHAR
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSD11')
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSD12',NUM)
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSIT0 (IROW,NUM)













      IMPLICIT      NONE
      INTEGER       NUM, I, IROW(NUM)





      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            IROW(I) = 0
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSD15')
         CALL GVSKIL
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSD16',NUM)
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSITC (IROW,ICON,NUM)














      IMPLICIT      NONE
      INTEGER       NUM, I, ICON
      INTEGER       IROW(NUM)





      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            IROW(I) = ICON
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSD17')
         CALL GVSKIL
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSD18',NUM)
         CALL GVSKIL
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSRTI (ROW,NUM)
















      IMPLICIT      NONE
      INTEGER       NUM, I
      REAL          ROW(NUM)





      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            ROW(I) = FLOAT(I)
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSB76')
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('TLSB87',NUM)
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSITI (IROW,NUM)
















      IMPLICIT      NONE
      INTEGER       NUM, I
      INTEGER       IROW(NUM)





      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            IROW(I) = I
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSD19')
         CALL GVSKIL
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSD20',NUM)
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSITJ (IROW,ISTART,ISTEP,NUM)





















      IMPLICIT      NONE
      INTEGER       NUM, I, ISTART, ISTEP, IROW(NUM)





      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            IROW(I) = ISTART+(I-1)*ISTEP
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSD21')
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSD22',NUM)
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSKIL







      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       I, J, IUNIT
      LOGICAL       GVFYON, COREIT, GVFFOP







      IF (WIFPAR(1012).EQ.0) GOTO 998
      CALL GVSNL6 (2)



      I=1
      J=1



      COREIT=GVFYON('?M3031',' ')
      IF (COREIT) THEN
         CALL GVSTT6 ('?M3032')
         CALL GVSTT6 ('?M3033')
         DO 10 IUNIT=1,100
            IF (IUNIT.EQ.5.OR.IUNIT.EQ.6) GOTO 10
            IF (GVFFOP(IUNIT)) CALL GVSCLF (IUNIT)
 10      CONTINUE



         IF (GVFYON('?M3028',' ')) THEN
            CALL MOL010 ('?M3029')
            J=J+I
            I=I+1
         END IF



         IF (GVFYON('?M3030',' ')) THEN
            CALL WIFDUMPSTK ('GVSKIL')
            J=J+I
            I=I+1
         END IF
         J=J-I
         CALL GVSKIL2 (I,J)

            CALL COREDUMP

      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSKILA







      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       I, J







      IF (WIFPAR(1012).EQ.0) GOTO 998



      I=1
      J=1
      J=J-I
      CALL GVSKIL2 (I,J)

         CALL COREDUMP




  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSKIL2 (I,J)







      IMPLICIT      NONE
      INTEGER       I, J





      I=I/J
      DO 10 I=1,-1,-1
         J=(J+1)/I
   10 CONTINUE





      RETURN
      END
      SUBROUTINE GVSMTH (IROW,WORK,NUM,WINDOW,TYPE,CYCLES)















      IMPLICIT      NONE
      INTEGER       NUM
      INTEGER       IROW(NUM), WORK(NUM), WINDOW, TYPE, CYCLES, I,
     +              ICYCLE, IMID, IHALF, IRANGE, IUSE
      LOGICAL       GVFIBN, GVFODD
      REAL          WEIGHT(25), SUM, DIV







      IF (NUM.LT.5) THEN
         CALL GVSTTE ('?TLSD27')
         GOTO 998
      END IF
      IF (FLOAT(WINDOW).GE.0.5*FLOAT(NUM)) THEN
         CALL GVSTTE ('?TLSD28')
         GOTO 998
      END IF
      IF (.NOT.GVFIBN(TYPE,1,2)) THEN
         CALL GVSTTE ('?TLSD29')
         GOTO 998
      END IF
      IF (.NOT.GVFODD(WINDOW)) THEN
         CALL GVSTTE ('?TLSD30')
         GOTO 998
      END IF
      IF (.NOT.GVFIBN(WINDOW,3,25)) THEN
         CALL GVSTTE ('?TLSD31')
         GOTO 998
      END IF
      IF (.NOT.GVFIBN(CYCLES,1,100)) THEN
         CALL GVSTTE ('?TLSD32')
         GOTO 998
      END IF



      IHALF=WINDOW/2



      DO 10 I=1,WINDOW
         IF (TYPE.EQ.1) THEN
            WEIGHT(I)=1.0
         ELSE IF (TYPE.EQ.2) THEN
            WEIGHT(I)=FLOAT(MIN(WINDOW+1-I,I))
         ELSE
            WEIGHT(I)=1.0
         END IF
   10 CONTINUE



      DO 40 ICYCLE=1,CYCLES



         CALL GVSCPI (WORK,IROW,NUM)



         DO 30 IMID=1,NUM
            SUM=0.0
            DIV=0.0
            DO 20 IRANGE=1,WINDOW
               IUSE=IMID-IHALF+IRANGE-1
               IF (GVFIBN(IUSE,1,NUM)) THEN
                  SUM=SUM+FLOAT(WORK(IUSE))*WEIGHT(IRANGE)
                  DIV=DIV+WEIGHT(IRANGE)
               END IF
   20       CONTINUE
            IROW(IMID)=NINT(SUM/DIV)
   30    CONTINUE
   40 CONTINUE



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSMTR (ROW,WORK,NUM,WINDOW,TYPE,CYCLES)















      IMPLICIT      NONE
      INTEGER       NUM, WINDOW, TYPE, CYCLES, I, ICYCLE, IMID, 
     +              IHALF, IRANGE, IUSE
      LOGICAL       GVFIBN, GVFODD
      REAL          ROW(NUM), WORK(NUM), WEIGHT(25), SUM, DIV







      IF (NUM.LT.5) THEN
         CALL GVSTTE ('?TLSD27')
         GOTO 998
      END IF
      IF (FLOAT(WINDOW).GE.0.5*FLOAT(NUM)) THEN
         CALL GVSTTE ('?TLSD28')
         GOTO 998
      END IF
      IF (.NOT.GVFIBN(TYPE,1,2)) THEN
         CALL GVSTTE ('?TLSD29')
         GOTO 998
      END IF
      IF (.NOT.GVFODD(WINDOW)) THEN
         CALL GVSTTE ('?TLSD30')
         GOTO 998
      END IF
      IF (.NOT.GVFIBN(WINDOW,3,25)) THEN
         CALL GVSTTE ('?TLSD31')
         GOTO 998
      END IF
      IF (.NOT.GVFIBN(CYCLES,1,100)) THEN
         CALL GVSTTE ('?TLSD32')
         GOTO 998
      END IF



      IHALF=WINDOW/2



      DO 10 I=1,WINDOW
         IF (TYPE.EQ.1) THEN
            WEIGHT(I)=1.0
         ELSE IF (TYPE.EQ.2) THEN
            WEIGHT(I)=FLOAT(MIN(WINDOW+1-I,I))
         ELSE
            WEIGHT(I)=1.0
         END IF
   10 CONTINUE



      DO 40 ICYCLE=1,CYCLES



         CALL GVSCPR (WORK,ROW,NUM)



         DO 30 IMID=1,NUM
            SUM=0.0
            DIV=0.0
            DO 20 IRANGE=1,WINDOW
               IUSE=IMID-IHALF+IRANGE-1
               IF (GVFIBN(IUSE,1,NUM)) THEN
                  SUM=SUM+WORK(IUSE)*WEIGHT(IRANGE)
                  DIV=DIV+WEIGHT(IRANGE)
               END IF
   20       CONTINUE
            ROW(IMID)=SUM/DIV
   30    CONTINUE
   40 CONTINUE



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSPCK (IROW,BROW,NUMNOW,NUM)



















      IMPLICIT      NONE
      INTEGER       NUM, NUMNOW, I
      INTEGER       IROW(NUM)
      LOGICAL       BROW(NUM)







      NUMNOW=0



      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            IF (BROW(I)) THEN
               NUMNOW=NUMNOW+1
               IROW(NUMNOW)=IROW(I)
            END IF
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSD40')
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSD41',NUM)
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSRT0 (ROW,NUM)













      IMPLICIT      NONE
      INTEGER       NUM, I
      REAL          ROW(NUM)





      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            ROW(I) = 0.0
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSB76')
         CALL GVSKIL
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSB77',NUM)
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSRTC (ROW,CON,NUM)














      IMPLICIT      NONE
      INTEGER       NUM, I
      REAL          ROW(NUM), CON





      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            ROW(I) = CON
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSB78')
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSB79',NUM)
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSRTR (ROW,NUM,VALLOW,VALHGH)












      IMPLICIT      NONE
      INTEGER       NUM, I
      REAL          VALLOW, VALHGH, ROW(NUM), VLLLOW, VLLHGH,
     +              ARANDM, GVFRND







      VLLLOW=VALLOW
      VLLHGH=VALHGH
      IF (VLLLOW.GT.VLLHGH) CALL GVSWAP (VLLLOW,VLLHGH)
      IF (VLLHGH-VLLLOW.LT.0.000001) THEN
         CALL GVSTTB ('?TLSB90')
         GOTO 998
      END IF



      DO 10 I=1,NUM



         ARANDM=GVFRND(0)



         ROW(I)=VLLLOW+ARANDM*(VLLHGH-VLLLOW)
   10 CONTINUE



  998 CONTINUE


      RETURN
      END
