summaryrefslogtreecommitdiff
path: root/Utilib/src/ALLDLM.f
blob: 4186798d905060e5c37dcbeae40ac1dc22dca41d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
*DECK ALLDLM
      SUBROUTINE ALLDLM (L4,ASS,VEC,Z,MU1,ITY)
*
*-----------------------------------------------------------------------
*
*Purpose:
* multiplication of a symmetric matrix in compressed diagonal storage
* mode by a vector.
*
*Copyright:
* Copyright (C) 1989 Ecole Polytechnique de Montreal
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version
*
*Author(s): A. Hebert
*
*Parameters: input
* L4      order of the coefficient matrix.
* ASS     coefficient matrix in compressed diagonal storage mode.
*         DIMENSION ASS(MU1(L4))
* VEC     vector to multiply.
* Z       vector that will be added to the result if ITY=2.
* MU1     position of each diagonal element in vector ASS.
* ITY     type of multiplication (ITY=1: Z=ASS*VEC;
*         ITY=2: Z=Z+(ASS-DIAG(ASS))*VEC).
*
*Parameters: output
* Z       solution of the multiplication.
*
*-----------------------------------------------------------------------
*
*----
*  SUBROUTINE ARGUMENTS
*----
      INTEGER L4,MU1(L4),ITY
      REAL ASS(*),VEC(L4),Z(L4)
*
      GO TO (10,60),ITY
*
* CALCULATION OF Z=ASS*VEC.
   10 Z(1)=ASS(MU1(1))*VEC(1)
      I1=MU1(1)+1
      DO 50 K=2,L4
      I2=MU1(K)
      KEY1=I2-K
      ZK=0.0
      DO 30 L=I1-I2+K,K-1
      ZK=ZK+ASS(KEY1+L)*VEC(L)
      Z(L)=Z(L)+ASS(KEY1+L)*VEC(K)
   30 CONTINUE
      Z(K)=ZK+ASS(KEY1+K)*VEC(K)
      I1=I2+1
   50 CONTINUE
      RETURN
*
* CALCULATION OF Z=Z+(ASS-DIAG(ASS))*VEC.
   60 I1=MU1(1)+1
      DO 80 K=2,L4
      I2=MU1(K)
      KEY1=I2-K
      DO 70 L=I1-I2+K,K-1
      Z(K)=Z(K)+ASS(KEY1+L)*VEC(L)
      Z(L)=Z(L)+ASS(KEY1+L)*VEC(K)
   70 CONTINUE
      I1=I2+1
   80 CONTINUE
      RETURN
      END