!+ Subroutine to evaluate the residual polynomial.
!
! Method:
!	Straightforward.
!
! Current Owner of Code: J. M. Edwards
!
! History:
!	Version		Date			Comment
!	1.0		12-04-95		First Version under RCS
!						(J. M. Edwards)
!
! Description of Code:
!   FORTRAN 77  with extensions listed in documentation.
!
!- ---------------------------------------------------------------------
      FUNCTION RESIDUAL_POLYNOMIAL(N_DATA
     &   , WEIGHT, RESIDUAL, U
     &   , K_EVALUATE
     &   )
!
!
      IMPLICIT NONE
!
!
!     INCLUDE HEADER FILES.
      INCLUDE 'incl/dimensions_spec.ucf'
      INCLUDE 'incl/dimensions_pp.ucf'
!
!     DUMMY ARGUMENTS.
      INTEGER 	!, INTENT(IN)
     &     N_DATA                           
!             NUMBER OF DATA POINTS
      REAL*8	!, INTENT(OUT)
     &     RESIDUAL_POLYNOMIAL              
!             VALUE OF RESIDUAL POLYNOMIAL
      REAL*8 	!, INTENT(IN)
     &     WEIGHT(NPD_AMOUNT+1)         
!             WEIGHTS FOR TERMS
     &   , RESIDUAL(NPD_AMOUNT+1)       
!             RESIDUALS
     &   , U(NPD_AMOUNT+1)  
!             AMOUNTS OF ABSORBER
     &   , K_EVALUATE                       
!             VALUE OF K FOR EVALUATION
!
!     LOCAL VARIABLES.
      INTEGER
     &     I                                
!             LOOP VARIABLE
!
!
      RESIDUAL_POLYNOMIAL=0.0D+00
      DO I=1, N_DATA
         RESIDUAL_POLYNOMIAL=RESIDUAL_POLYNOMIAL
     &      +WEIGHT(I)*RESIDUAL(I)*EXP(-K_EVALUATE*U(I))
      ENDDO
!
!
      RETURN
      END
