      SUBROUTINE MAKRET(SAT,RTCMPG,FGTMPQ,FGRADT,PREDVC,SHRKMX,RETTQ)
      implicit none
C********************************************************************
C
C   NAME- MAKRET
C
C   LANGUAGE- VS FORTRAN   TYPE- SUBROUTINE    COMPUTER- CRAY J916
C
C   VERSION- 1.0      DATE- 11/21/91     PROGRAMMER- CARLA NEIGH, SMSRC
C   VERSION- 2.0      DATE-  6/22/94     PROGRAMMER- CARLA NEIGH, SMSRC
C    *** SATOV-15: FGRADT DIMENSION INCREASED BY NANCIL.  INCLUDE
C                  MEMBER RETPARM ADDED AND NANCIL, NUMCHN, AND NUMLVL
C                  ARE REMOVED FROM ARGUMENT LIST.  SHRINKAGE ESTIMATOR
C                  MATRIX IS APPLIED TO DIFFERENCE BETWEEN PREDVC AND
C                  FGRADT.
C   VERSION- 3.0      DATE-  6/03/96     PROGRAMMER- TIM GARDNER (HSTX)
C   VERSION- 3.1      DATE-  6/19/97     PROGRAMMER- LEAH WILSON (HSTX)
C
C   FUNCTION- THIS SUBROUTINE OBTAINS A RETRIEVAL.  THE RETRIEVAL
C             CONSISTS OF A NUMBER OF LEVELS OF TEMPERATURE AND WATER
C             VAPOR MIXING RATIO.  THE RETRIEVAL IS COMPUTED BY SUMMING
C             THE FIRST GUESS RETRIEVAL WITH THE PRODUCT OF THE SA-
C             TRANSPOSE MATRIX, THE RETRIEVAL COMPONENT G, THE SHRINKAGE
C             ESTIMATOR COEFFICIENT MATRIX, AND THE DIFFERENCE BETWEEN
C             THE OBSERVED PREDICTORS VECTOR AND THE FIRST GUESS
C             PREDICTORS VECTOR.
C
C   VERSION 3.0- DOCUMENTATION AND SYNTAX CHANGES FOR ATOVS BASELINE
C                ON THE CRAY.
C   VERSION 3.1- THE RADIANCE SIMULATED FROM THE BIN MEAN PROFILE IS NOW
C                USED FOR CHANNELS 2, 25, 26, AND 27 FOR ALL LEVELS OF
C                THE RETRIEVAL.
C
C   CALLING SEQUENCE PARAMETERS-
C   NAME   TYPE   I/O   DESCRIPTION
C   ----   ----   ---   -----------
C   SAT    REAL    I    MATRIX (DIM RETPARM:NUMLVL X RETPARM:NUMCHN)
C                       CONTAINING RETRIEVAL OPERATOR COMPONENT
C                       SA-TRANSPOSE.
C   RTCMPG REAL    I    MATRIX (DIM RETPARM:NUMCHN X RETPARM:NUMCHN)
C                       WHICH IS THE INVERSE OF THE SUM OF THE RETRIEVAL
C                       COMPONENT ASA-TRANSPOSE AND THE NOISE
C                       COVARIANCE MATRIX.
C   FGTMPQ REAL    I    VECTOR (DIM RETPARM:NUMLVL) CONTAINING THE
C                       FIRST GUESS TEMPPERATURE AND MIXING RATIO
C                       PROFILE (TEMPERATURE PROFILE IS IN PLANCK
C                       RADIANCE AT 700 CM-1).
C   FGRADT REAL    I    VECTOR (DIM RETPARM:NUMCHN+NANCIL) CONTAINING
C                       THE FIRST GUESS RADIANCES (IN PLANCK RADIANCE
C                       AT 700 CM-1) AND THE ADDITIONAL PREDICTORS.
C   PREDVC REAL    I    VECTOR (DIM RETPARM:NUMCHN+RETPARM:NANCIL)
C                       CONTAINING THE OBSERVED PREDICTOR VECTOR
C                       FOR THE RETRIEVAL GRID POINT (FIRST NUMCHN
C                       VALUES ARE RADIANCES, REMAINING NANCIL ELEMENTS
C                       ARE ANCILLARY VALUES).
C   SHRKMX REAL    I    MATRIX (DIM RETPARM:NUMCHN X RETPARM:NUMCHN+
C                       NANCIL) CONTAINING THE SHRINKAGE ESTIMATOR
C                       COEFFICIENTS.
C   RETTQ  REAL    O    VECTOR (DIM RETPARM:NUMLVL) CONTAINING THE
C                       RETRIEVED TEMPERATURE AND MIXING RATIO
C                       PROFILE FOR THE RETRIEVAL GRID POINT
C                       (TEMPERATURE PROFILE IS IN PLANCK RADIANCE
C                       AT 700 CM-1).
C
C   LOCAL VARIABLES
C   NAME   TYPE   DESCRIPTION
C   ----   ----   -----------
C   DELTAP REAL   VECTOR (DIM RETPARM:NUMCHN+NANCIL) CONTAINING
C                 PREDVC MINUS FGRADT.
C   GXDLBT REAL   VECTOR (DIM RETPARM:NUMCHN) CONTAINING THE PRODUCT OF
C                 RTCMPG AND SPRSLT.
C   SATXGB REAL   VECTOR (DIM RETPARM:NUMLVL) CONTAINING THE PRODUCT OF
C                 SAT AND GXDLBT.
C   SPRSLT REAL   VECTOR (DIM RETPARM:NUMCHN) CONTAINING THE
C                 PRODUCT OF SHRKMX AND DELTAP.
C
C   SUBPROGRAMS CALLED- VSUB, MMULT, VADD
C
C   EXIT STATES- NONE
C
C********************************************************************
C
      INCLUDE 'RETPARM'
C
      REAL SAT(NUMLVL,NUMCHN), RTCMPG(NUMCHN,NUMCHN), FGTMPQ(NUMLVL)
      REAL FGRADT(NUMCHN), PREDVC(NUMCHN+NANCIL), RETTQ(NUMLVL)
      REAL SHRKMX(NUMCHN,NUMCHN+NANCIL)
C
      REAL DELTAP(NUMCHN+NANCIL), GXDLBT(NUMCHN), SATXGB(NUMLVL)
      REAL SPRSLT(NUMCHN)
C
C  THE RETRIEVAL PROFILE IS COMPUTED FROM THE FOLLOWING FORMULA:
C     RETTQ = FGTMPQ + SAT * (RTCMPG * (SHRKMX * (PREDVC - FGRADT)))
C
C  MULTIPLY THE SHRINKAGE ESTIMATORS COEFFICIENT MATRIX BY THE
C  RESULTING VECTOR.
C
      CALL MMULT(SHRKMX,NUMCHN,NUMCHN+NANCIL,PREDVC,NUMCHN+NANCIL,1,
     1           SPRSLT)
C
C  SUBTRACT FIRST GUESS VECTOR FROM THE VECTOR OBTAINED IN THE
C  PREVIOUS STEP.
C
      CALL VSUB(SPRSLT,FGRADT,DELTAP,NUMCHN)
C
C  MULTIPLY INVERSE OF SUM OF ASA-TRANSPOSE AND THE NOISE COVARIANCE
C  MATRIX (WHICH IS RTCMPG) BY THE ABOVE VECTOR.
C
      CALL MMULT(RTCMPG,NUMCHN,NUMCHN,DELTAP,NUMCHN,1,GXDLBT)
C
C  MULTIPLY SA-TRANSPOSE BY THE RESULTING VECTOR FROM THE PREVIOUS
C  STEP.
C
      CALL MMULT(SAT,NUMLVL,NUMCHN,GXDLBT,NUMCHN,1,SATXGB)
C
C  ADD THE RESULTING VECTOR IN THE PREVIOUS STEP TO THE MEAN
C  TEMPERATURE/MIXING RATIO PROFILE TO GET THE RETRIEVED PROFILE.
C
      CALL VADD(FGTMPQ,SATXGB,RETTQ,NUMLVL)
C
      RETURN
      END
