C
C     ..................................................................
C
C        SUBROUTINE DQTFG
C
C        PURPOSE
C           TO COMPUTE THE VECTOR OF INTEGRAL VALUES FOR A GIVEN
C           GENERAL TABLE OF ARGUMENT AND FUNCTION VALUES.
C
C        USAGE
C           CALL DQTFG (X,Y,Z,NDIM)
C
C        DESCRIPTION OF PARAMETERS
C           X      - DOUBLE PRECISION INPUT VECTOR OF ARGUMENT VALUES.
C           Y      - DOUBLE PRECISION INPUT VECTOR OF FUNCTION VALUES.
C           Z      - RESULTING DOUBLE PRECISION VECTOR OF INTEGRAL
C                    VALUES. Z MAY BE IDENTICAL WITH X OR Y.
C           NDIM   - THE DIMENSION OF VECTORS X,Y,Z.
C
C        REMARKS
C           NO ACTION IN CASE NDIM LESS THAN 1.
C
C        SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
C           NONE
C
C        METHOD
C           BEGINNING WITH Z(1)=0, EVALUATION OF VECTOR Z IS DONE BY
C           MEANS OF TRAPEZOIDAL RULE (SECOND ORDER FORMULA).
C           FOR REFERENCE, SEE
C           F.B.HILDEBRAND, INTRODUCTION TO NUMERICAL ANALYSIS,
C           MCGRAW-HILL, NEW YORK/TORONTO/LONDON, 1956, PP.75.
C
C     ..................................................................
C
      SUBROUTINE DQTFG(X,Y,Z,NDIM)
C
C
      DIMENSION X(1),Y(1),Z(1)
      DOUBLE PRECISION X,Y,Z,SUM1,SUM2
C
      SUM2=0.D0
      IF(NDIM-1)4,3,1
C
C     INTEGRATION LOOP
    1 DO 2 I=2,NDIM
      SUM1=SUM2
      SUM2=SUM2+.5D0*(X(I)-X(I-1))*(Y(I)+Y(I-1))
    2 Z(I-1)=SUM1
    3 Z(NDIM)=SUM2
    4 RETURN
      END
