      SUBROUTINE SOLVE3(F, M1, M, N1, QR, D, Y, MMPNN)
C SUBROUTINE SOLVE3 IS CALLED ONLY BY SUBROUTINE SOLVE2.
C THIS SUBROUTINE CALCULATES NEW VALUES OF F.
      REAL C, D(1), F(1), QR(MMPNN,N1), Y(1)
      DOUBLE PRECISION SUM
      MV = 1
      MH = M1
      DO 100 NS=1,N1
        J = M + NS
        IF (NS.EQ.M1+1) GO TO 10
        GO TO 20
   10   MV = M1 + 1
        MH = M
   20   NSM1 = NS - 1
        SUM = -DBLE(F(J))
        IF (NS.EQ.1) GO TO 40
        DO 30 L=1,NSM1
          MPL = M + L
          SUM = SUM + DBLE(QR(MPL,NS))*DBLE(Y(L))
   30   CONTINUE
   40   Y(NS) = -SUM
        IF (NS.GT.M1) GO TO 50
        GO TO 60
   50   C = -Y(NS)
        GO TO 70
   60   C = 0.0
   70   SUM = DBLE(C)
        DO 80 L=MV,MH
          SUM = SUM + DBLE(QR(L,NS))*DBLE(F(L))
   80   CONTINUE
        C = SUM
        C = C/D(NS)
        F(J) = C
        DO 90 L=MV,M
          F(L) = F(L) - C*QR(L,NS)
   90   CONTINUE
  100 CONTINUE
      IF (1.GT.M1) GO TO 150
      DO 110 L=1,M1
        F(L) = 0.0
  110 CONTINUE
      DO 140 NS=1,M1
        SUM = -DBLE(Y(NS))
        DO 120 L=1,M
          SUM = SUM + DBLE(QR(L,NS))*DBLE(F(L))
  120   CONTINUE
        C = SUM
        C = C/D(NS)
        DO 130 L=1,M1
          F(L) = F(L) - C*QR(L,NS)
  130   CONTINUE
  140 CONTINUE
  150 DO 170 NS=1,N1
        J = M + N1 + 1 - NS
        MPN1 = M + N1
        SUM = 0.0
        DO 160 L=J,MPN1
          LMM = L - M
          SUM = SUM + DBLE(QR(J,LMM))*DBLE(F(L))
  160   CONTINUE
        F(J) = -SUM
  170 CONTINUE
      RETURN
      END
