*DECK ALVDLS
      SUBROUTINE ALVDLS (LTSW,MU1,ASS,F,ISEG,LON,NBL,LBL)
*
*-----------------------------------------------------------------------
*
* SOLUTION OF A SYMMETRIC LINEAR SYSTEM WHERE THE COEFFICIENT MATRIX
* HAVE BEEN PREVIOUSLY FACTORIZED AS LDL(T). SUPERVECTORIAL VERSION
*
* INPUT PARAMETERS:
*    LTSW : MAXIMUM BANDWIDTH. =2 FOR TRIDIAGONAL SYSTEMS.
*     MU1 : POSITION OF EACH DIAGONAL ELEMENT IN VECTOR ASS.
*           DIMENSION MU1(L4) WHERE L4=SUM(LBL(I))
*     ASS : LDL(T) FACTORS OF THE COEFFICIENT MATRIX IN COMPRESSED
*           DIAGONAL STORAGE MODE. DIMENSION ASS(ISEG,MU1(L4))
*       F : RIGHT-HAND SIDE OF THE LINEAR SYSTEM. DIMENSION F(ISEG,L4)
*    ISEG : NUMBER OF ELEMENTS IN A VECTOR REGISTER.
*     LON : NUMBER OF GROUPS OF LINEAR SYSTEMS.
*     NBL : NUMBER OF LINEAR SYSTEMS IN EACH GROUP. DIMENSION NBL(LON)
*     LBL : NUMBER OF UNKNOWNS IN EACH GROUP. DIMENSION LBL(LON)
*
* OUTPUT PARAMETER:
*     F : SOLUTION OF THE LINEAR SYSTEM. DIMENSION F(ISEG,L4)
*
*-------------------------------------- AUTHOR: A. HEBERT ; 15/10/92 ---
*
      INTEGER ISEG,LON,MU1(*),NBL(LON),LBL(LON)
      REAL ASS(ISEG,*),F(ISEG,*)
      REAL, DIMENSION(:), ALLOCATABLE :: T
*
      ALLOCATE(T(ISEG))
      LBL0=0
      IMAX=0
      DO 200 ILON=1,LON
      L4=LBL(ILON)
      NBANC=NBL(ILON)
      IF(L4.EQ.1) THEN
         IMAX=IMAX+1
CDIR$ SHORTLOOP
         DO 10 IB=1,NBANC
   10    F(IB,LBL0+1)=F(IB,LBL0+1)*ASS(IB,IMAX)
      ELSE IF(LTSW.GT.2) THEN
         IMAX=MU1(LBL0+L4)
         K1=MU1(LBL0+1)+1
         DO 50 I=LBL0+2,LBL0+L4
         K2=MU1(I)
         KJ=I-K2+K1
CDIR$ SHORTLOOP
         DO 20 IB=1,NBANC
   20    T(IB)=-F(IB,I)
         DO 40 K=K1,K2-1
CDIR$ SHORTLOOP
         DO 30 IB=1,NBANC
   30    T(IB)=T(IB)+F(IB,KJ)*ASS(IB,K)
   40    KJ=KJ+1
         K1=K2+1
CDIR$ SHORTLOOP
         DO 50 IB=1,NBANC
   50    F(IB,I)=-T(IB)
*
         DO 60 I=LBL0+1,LBL0+L4
         K1=MU1(I)
CDIR$ SHORTLOOP
         DO 60 IB=1,NBANC
   60    F(IB,I)=F(IB,I)*ASS(IB,K1)
*
         K2=IMAX
         DO 100 I=LBL0+L4,LBL0+2,-1
CDIR$ SHORTLOOP
         DO 70 IB=1,NBANC
   70    T(IB)=-F(IB,I)
         K1=MU1(I-1)+1
         KJ=I-K2+K1
         DO 90 K=K1,K2-1
CDIR$ SHORTLOOP
         DO 80 IB=1,NBANC
   80    F(IB,KJ)=F(IB,KJ)+ASS(IB,K)*T(IB)
   90    KJ=KJ+1
  100    K2=K1-1
      ELSE IF(LTSW.EQ.2) THEN
         K1=IMAX+2
         DO 130 I=LBL0+2,LBL0+L4
         KJ=I-1
CDIR$ SHORTLOOP
         DO 110 IB=1,NBANC
  110    T(IB)=-F(IB,I)+F(IB,KJ)*ASS(IB,K1)
CDIR$ SHORTLOOP
         DO 120 IB=1,NBANC
  120    F(IB,I)=-T(IB)
  130    K1=K1+2
*
         DO 140 I=LBL0+1,LBL0+L4
         K1=IMAX+2*(I-LBL0)-1
CDIR$ SHORTLOOP
         DO 140 IB=1,NBANC
  140    F(IB,I)=F(IB,I)*ASS(IB,K1)
*
         K1=IMAX+2*L4-2
         DO 170 I=LBL0+L4,LBL0+2,-1
         KJ=I-1
CDIR$ SHORTLOOP
         DO 150 IB=1,NBANC
  150    T(IB)=-F(IB,I)
CDIR$ SHORTLOOP
         DO 160 IB=1,NBANC
  160    F(IB,KJ)=F(IB,KJ)+ASS(IB,K1)*T(IB)
  170    K1=K1-2
         IMAX=IMAX+2*L4-1
      ENDIF
  200 LBL0=LBL0+L4
      DEALLOCATE(T)
      RETURN
      END
