      SUBROUTINE SLVMP(MO, N, A, KA, B, X, WK, IWK, IERR)
C     ******************************************************************
C     SOLUTION OF REAL LINEAR EQUATIONS WITH ITERATIVE IMPROVEMENT
C     ******************************************************************
      DIMENSION A(KA,N), B(N), X(N), WK(1), IWK(N)
C     -------------------
C     DIMENSION WK(N*N + N)
C     -------------------
      IF (MO .NE. 0) GO TO 10
C
C             COMPUTE THE LU DECOMPOSITION OF A
C
      CALL MCOPY(N, N, A, KA, WK, N)
      CALL SGEFA(WK, N, N, IWK, IERR)
      IF (IERR .EQ. 0) GO TO 10
      IERR = -IERR
      RETURN
C
C            SOLVE THE SYSTEM OF EQUATIONS AX = B
C
   10 DO 11 I = 1,N
   11 X(I) = B(I)
C
      IR = N*N + 1
      CALL SGESL(WK, N, N, IWK, X, 0)
      CALL LUIMP(A, KA, N, WK(1), N, IWK, B, X, WK(IR), IERR)
      RETURN
      END
