# qc25f.f

          SUBROUTINE QC25F (F, A, B, OMEGA, INTEGR, NRMOM, MAXP1, KSAVE,
         +   RESULT, ABSERR, NEVAL, RESABS, RESASC, MOMCOM, CHEBMO)
    C***BEGIN PROLOGUE  QC25F
    C***PURPOSE  To compute the integral I=Integral of F(X) over (A,B)
    C            Where W(X) = COS(OMEGA*X) Or (WX)=SIN(OMEGA*X)
    C            and to compute J=Integral of ABS(F) over (A,B). For small
    C            value of OMEGA or small intervals (A,B) 15-point GAUSS-
    C            KRONROD Rule used. Otherwise generalized CLENSHAW-CURTIS us
    C***LIBRARY   SLATEC (QUADPACK)
    C***CATEGORY  H2A2A2
    C***TYPE      SINGLE PRECISION (QC25F-S, DQC25F-D)
    C***KEYWORDS  CLENSHAW-CURTIS METHOD, GAUSS-KRONROD RULES,
    C             INTEGRATION RULES FOR FUNCTIONS WITH COS OR SIN FACTOR,
    C             QUADPACK, QUADRATURE
    C***AUTHOR  Piessens, Robert
    C             Applied Mathematics and Programming Division
    C             K. U. Leuven
    C           de Doncker, Elise
    C             Applied Mathematics and Programming Division
    C             K. U. Leuven
    C***DESCRIPTION
    C
    C        Integration rules for functions with COS or SIN factor
    C        Standard fortran subroutine
    C        Real version
    C
    C        PARAMETERS
    C         ON ENTRY
    C           F      - Real
    C                    Function subprogram defining the integrand
    C                    function F(X). The actual name for F needs to
    C                    be declared E X T E R N A L in the calling program.
    C
    C           A      - Real
    C                    Lower limit of integration
    C
    C           B      - Real
    C                    Upper limit of integration
    C
    C           OMEGA  - Real
    C                    Parameter in the WEIGHT function
    C
    C           INTEGR - Integer
    C                    Indicates which WEIGHT function is to be used
    C                       INTEGR = 1   W(X) = COS(OMEGA*X)
    C                       INTEGR = 2   W(X) = SIN(OMEGA*X)
    C
    C           NRMOM  - Integer
    C                    The length of interval (A,B) is equal to the length
    C                    of the original integration interval divided by
    C                    2**NRMOM (we suppose that the routine is used in an
    C                    adaptive integration process, otherwise set
    C                    NRMOM = 0). NRMOM must be zero at the first call.
    C
    C           MAXP1  - Integer
    C                    Gives an upper bound on the number of Chebyshev
    C                    moments which can be stored, i.e. for the
    C                    intervals of lengths ABS(BB-AA)*2**(-L),
    C                    L = 0,1,2, ..., MAXP1-2.
    C
    C           KSAVE  - Integer
    C                    Key which is one when the moments for the
    C                    current interval have been computed
    C
    C         ON RETURN
    C           RESULT - Real
    C                    Approximation to the integral I
    C
    C           ABSERR - Real
    C                    Estimate of the modulus of the absolute
    C                    error, which should equal or exceed ABS(I-RESULT)
    C
    C           NEVAL  - Integer
    C                    Number of integrand evaluations
    C
    C           RESABS - Real
    C                    Approximation to the integral J
    C
    C           RESASC - Real
    C                    Approximation to the integral of ABS(F-I/(B-A))
    C
    C         ON ENTRY AND RETURN
    C           MOMCOM - Integer
    C                    For each interval length we need to compute the
    C                    Chebyshev moments. MOMCOM counts the number of
    C                    intervals for which these moments have already been
    C                    computed. If NRMOM.LT.MOMCOM or KSAVE = 1, the
    C                    Chebyshev moments for the interval (A,B) have
    C                    already been computed and stored, otherwise we
    C                    compute them and we increase MOMCOM.
    C
    C           CHEBMO - Real
    C                    Array of dimension at least (MAXP1,25) containing
    C                    the modified Chebyshev moments for the first MOMCOM
    C                    MOMCOM interval lengths
    C
    C***REFERENCES  (NONE)
    C***ROUTINES CALLED  QCHEB, QK15W, QWGTF, R1MACH, SGTSL
    C***REVISION HISTORY  (YYMMDD)
    C   810101  DATE WRITTEN
    C   861211  REVISION DATE from Version 3.2
    C   891214  Prologue converted to Version 4.0 format.  (BAB)
    C***END PROLOGUE  QC25F