*DECK ALVDLM
      SUBROUTINE ALVDLM (LTSW,ASS,VEC,Z,MU1,ITY,ISEG,LON,NBL,LBL)
*
*-----------------------------------------------------------------------
*
* MULTIPLICATION OF A SYMMETRIC MATRIX IN COMPRESSED DIAGONAL STORAGE
* MODE BY A VECTOR. SUPERVECTORIAL VERSION.
*
* INPUT PARAMETERS:
*    LTSW : MAXIMUM BANDWIDTH. =2 FOR TRIDIAGONAL SYSTEMS.
*     ASS : LDL(T) FACTORS OF THE COEFFICIENT MATRIX IN COMPRESSED
*           DIAGONAL STORAGE MODE. DIMENSION ASS(ISEG,MU1(L4))
*     VEC : VECTOR TO MULTIPLY.
*       Z : VECTOR THAT WILL BE ADDED TO THE RESULT IF ITY=2.
*           DIMENSION VEC(ISEG,L4),Z(ISEG,L4) WHERE L4=SUM(LBL(I))
*     MU1 : POSITION OF EACH DIAGONAL ELEMENT IN VECTOR ASS.
*           DIMENSION MU1(L4)
*     ITY : ITY=1 ---- Z=ASS*VEC
*           ITY=2 ---- Z=Z+(ASS-DIAG(ASS))*VEC
*    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:
*       Z : SOLUTION OF THE MULTIPLICATION. DIMENSION Z(ISEG,L4)
*
*-------------------------------------- AUTHOR: A. HEBERT ; 15/10/92 ---
*
      DIMENSION ASS(ISEG,*),VEC(ISEG,*),Z(ISEG,*),MU1(*),NBL(*),LBL(*)
      LBL0=0
      IMAX=0
      DO 300 ILON=1,LON
      L4=LBL(ILON)
      NBANC=NBL(ILON)
      IF((LTSW.GT.2).AND.(ITY.EQ.1)) THEN
*        CALCULATION OF Z=ASS*VEC.
CDIR$ SHORTLOOP
         DO 30 IB=1,NBANC
   30    Z(IB,LBL0+1)=ASS(IB,MU1(LBL0+1))*VEC(IB,LBL0+1)
         I1=MU1(LBL0+1)+1
         DO 90 K=LBL0+2,LBL0+L4
         I2=MU1(K)
         KEY1=I2-K
CDIR$ SHORTLOOP
         DO 40 IB=1,NBANC
   40    Z(IB,K)=0.0
         DO 60 L=K+I1-I2,K-1
         KEYL=KEY1+L
CDIR$ SHORTLOOP
         DO 50 IB=1,NBANC
         Z(IB,K)=Z(IB,K)+ASS(IB,KEYL)*VEC(IB,L)
   50    Z(IB,L)=Z(IB,L)+ASS(IB,KEYL)*VEC(IB,K)
   60    CONTINUE
CDIR$ SHORTLOOP
         DO 80 IB=1,NBANC
   80    Z(IB,K)=Z(IB,K)+ASS(IB,KEY1+K)*VEC(IB,K)
   90    I1=I2+1
      ELSE IF((LTSW.GT.2).AND.(ITY.EQ.2)) THEN
*        CALCULATION OF Z=Z+(ASS-DIAG(ASS))*VEC.
         I1=MU1(LBL0+1)+1
         DO 150 K=LBL0+2,LBL0+L4
         I2=MU1(K)
         KEY1=I2-K
         IF(I1.EQ.I2) GO TO 150
         DO 130 L=K+I1-I2,K-1
         KEYL=KEY1+L
CDIR$ SHORTLOOP
         DO 120 IB=1,NBANC
         Z(IB,K)=Z(IB,K)+ASS(IB,KEYL)*VEC(IB,L)
  120    Z(IB,L)=Z(IB,L)+ASS(IB,KEYL)*VEC(IB,K)
  130    CONTINUE
  150    I1=I2+1
      ELSE IF((LTSW.EQ.2).AND.(ITY.EQ.1)) THEN
*        CALCULATION OF Z=ASS*VEC FOR A 3-DIAGONAL SYSTEM.
CDIR$ SHORTLOOP
         DO 180 IB=1,NBANC
  180    Z(IB,LBL0+1)=ASS(IB,IMAX+1)*VEC(IB,LBL0+1)
         I1=2
         DO 230 K=LBL0+2,LBL0+L4
         KEYL=IMAX+I1
CDIR$ SHORTLOOP
         DO 210 IB=1,NBANC
         Z(IB,K)=ASS(IB,KEYL)*VEC(IB,K-1)+ASS(IB,KEYL+1)*VEC(IB,K)
  210    Z(IB,K-1)=Z(IB,K-1)+ASS(IB,KEYL)*VEC(IB,K)
  230    I1=I1+2
         IMAX=IMAX+I1-1
      ELSE IF((LTSW.EQ.2).AND.(ITY.EQ.2)) THEN
*        CALCULATION OF Z=Z+(ASS-DIAG(ASS))*VEC FOR A 3-DIAGONAL SYSTEM.
         I1=2
         DO 280 K=LBL0+2,LBL0+L4
         KEYL=IMAX+I1
CDIR$ SHORTLOOP
         DO 260 IB=1,NBANC
         Z(IB,K)=Z(IB,K)+ASS(IB,KEYL)*VEC(IB,K-1)
  260    Z(IB,K-1)=Z(IB,K-1)+ASS(IB,KEYL)*VEC(IB,K)
  280    I1=I1+2
         IMAX=IMAX+I1-1
      ENDIF
  300 LBL0=LBL0+L4
      RETURN
      END
