      SUBROUTINE NPIVOT(N,M,A,KA,B,KB,D,IERR)
C     ******************************************************************
C     MATRIX INVERSION/EQUATION SOLVING WITHOUT PIVOT SEARCH
C     ******************************************************************
      DIMENSION A(1),B(1)
C     ----------
      IERR=0
      MAXA=KA*N
      MAXB=KB*M
      KCOL=0
      DO 24 K=1,N
      KK=KCOL+K
C
C     EXAMINE THE PIVOT ELEMENT
C
      PIVOT=A(KK)
      D=D*PIVOT
      IF (PIVOT.NE.0.) GO TO 10
      IERR=1
      RETURN
C
C     DIVIDE THE PIVOT ROW BY THE PIVOT ELEMENT
C
   10 A(KK)=1.0
      DO 11 KL=K,MAXA,KA
   11 A(KL)=A(KL)/PIVOT
      IF (M.LE.0) GO TO 20
      DO 12 KL=K,MAXB,KB
   12 B(KL)=B(KL)/PIVOT
C
C     REDUCE THE NON-PIVOT ROWS
C
   20 DO 23 J=1,N
      IF (J.EQ.K) GO TO 23
      JK=KCOL+J
      T=A(JK)
      A(JK)=0.0
      JL=J
      KL=K
      DO 21 L=1,N
      A(JL)=A(JL)-A(KL)*T
      JL=JL+KA
   21 KL=KL+KA
      IF (M.LE.0) GO TO 23
      JL=J
      KL=K
      DO 22 L=1,M
      B(JL)=B(JL)-B(KL)*T
      JL=JL+KB
   22 KL=KL+KB
   23 CONTINUE
   24 KCOL=KCOL+KA
      RETURN
      END
