*DECK ALSBC
      SUBROUTINE ALSBC (N,IS,B,IER,MAX)
*
*-----------------------------------------------------------------------
*
* SOLUTION OF A SYSTEM OF LINEAR EQUATIONS USING GAUSSIAN ELIMINATION
* WITH PARTIAL PIVOTING. COMPLEX*16 VERSION.
*
* INPUT PARAMETERS:
*  N       : ORDER OF THE COEFFICIENT MATRIX.
*  IS      : NUMBER OF RIGHT HAND VECTORS.
*  B       : COEFFICIENT MATRIX AUGMENTED WITH THE RIGHT HAND VECTORS.
*            DIMENSION B(MAX,N+IS)
*  MAX     : FIRST DIMENTION OF MATRIX B.
*
* OUTPUT PARAMETERS:
*  B       : SOLUTION VECTORS, STARTING AT B(1,N+1).
*  IER     : ERROR FLAG. EXECUTION FAILURE IF IER.NE.0.
*
*------------------------------------------------ AUTHOR: A. HEBERT ----
*
      IMPLICIT COMPLEX*16 (A-H,O-Z)
      DOUBLE PRECISION TEST
      DIMENSION B(MAX,*)
      IN=0
      M=N+IS
      IER=0
      IF (N.EQ.1) GO TO 100
*
* SEARCH FOR MAXIMUM PIVOT ON COLUMN JCOL.
      NM1=N-1
      NP1=N+1
      DO 40 JCOL=1,NM1
      TEST=0.0D0
      DO 10 I=JCOL,N
      IF (ABS(B(I,JCOL)).LE.TEST) GO TO 10
      TEST=ABS(B(I,JCOL))
      IN=I
10    CONTINUE
      IF (TEST.EQ.0.0D0) GO TO 120
*
* TRIANGULARIZATION.
      PMX=B(IN,JCOL)
      B(IN,JCOL)=B(JCOL,JCOL)
      IP1=JCOL+1
      DO 40 J=IP1,M
      PER=B(IN,J)/PMX
      B(IN,J)=B(JCOL,J)
      B(JCOL,J)=PER
      DO 40 I=IP1,N
40    B(I,J)=B(I,J)-B(I,JCOL)*PER
      PER=B(N,N)
      DO 70 J=NP1,M
70    B(N,J)=B(N,J)/PER
*
* BACK SUBSTITUTION.
      DO 90 IN=2,N
      I=N-IN+1
      IP1=I+1
      DO 90 J=NP1,M
      PER=B(I,J)
      DO 80 K=IP1,N
80    PER=PER-B(I,K)*B(K,J)
90    B(I,J)=PER
      RETURN
*
100   PER=B(1,1)
      IF (PER.EQ.(0.0D0,0.0D0)) GO TO 120
      DO 110 J=2,M
110   B(1,J)=B(1,J)/PER
      RETURN
120   IER=1
      RETURN
      END
