~ubuntu-branches/ubuntu/wily/julia/wily

« back to all changes in this revision

Viewing changes to deps/openlibm/slatec/dslui4.f

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-01-16 12:29:42 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130116122942-x86e42akjq31repw
Tags: 0.0.0+20130107.gitd9656f41-1
* New upstream snashot
* No longer try to rebuild helpdb.jl.
   + debian/rules: remove helpdb.jl from build-arch rule
   + debian/control: move back python-sphinx to Build-Depends-Indep
* debian/copyright: reflect upstream changes
* Add Build-Conflicts on libatlas3-base (makes linalg tests fail)
* debian/rules: replace obsolete USE_DEBIAN makeflag by a list of
  USE_SYSTEM_* flags
* debian/rules: on non-x86 systems, use libm instead of openlibm
* dpkg-buildflags.patch: remove patch, applied upstream
* Refreshed other patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
*DECK DSLUI4
 
2
      SUBROUTINE DSLUI4 (N, B, X, IL, JL, L, DINV, IU, JU, U)
 
3
C***BEGIN PROLOGUE  DSLUI4
 
4
C***PURPOSE  SLAP Backsolve for LDU Factorization.
 
5
C            Routine to solve a system of the form  (L*D*U)' X = B,
 
6
C            where L is a unit lower triangular matrix, D is a diagonal
 
7
C            matrix, and U is a unit upper triangular matrix and '
 
8
C            denotes transpose.
 
9
C***LIBRARY   SLATEC (SLAP)
 
10
C***CATEGORY  D2E
 
11
C***TYPE      DOUBLE PRECISION (SSLUI4-S, DSLUI4-D)
 
12
C***KEYWORDS  ITERATIVE PRECONDITION, NON-SYMMETRIC LINEAR SYSTEM SOLVE,
 
13
C             SLAP, SPARSE
 
14
C***AUTHOR  Greenbaum, Anne, (Courant Institute)
 
15
C           Seager, Mark K., (LLNL)
 
16
C             Lawrence Livermore National Laboratory
 
17
C             PO BOX 808, L-60
 
18
C             Livermore, CA 94550 (510) 423-3141
 
19
C             seager@llnl.gov
 
20
C***DESCRIPTION
 
21
C
 
22
C *Usage:
 
23
C     INTEGER N, IL(NL), JL(NL), IU(NU), JU(NU)
 
24
C     DOUBLE PRECISION B(N), X(N), L(NL), DINV(N), U(NU)
 
25
C
 
26
C     CALL DSLUI4( N, B, X, IL, JL, L, DINV, IU, JU, U )
 
27
C
 
28
C *Arguments:
 
29
C N      :IN       Integer
 
30
C         Order of the Matrix.
 
31
C B      :IN       Double Precision B(N).
 
32
C         Right hand side.
 
33
C X      :OUT      Double Precision X(N).
 
34
C         Solution of (L*D*U)trans x = b.
 
35
C IL     :IN       Integer IL(NL).
 
36
C JL     :IN       Integer JL(NL).
 
37
C L      :IN       Double Precision L(NL).
 
38
C         IL, JL, L contain the unit lower triangular  factor of the
 
39
C         incomplete decomposition of some matrix stored in SLAP Row
 
40
C         format.  The diagonal of ones *IS* stored.  This structure
 
41
C         can    be  set  up  by   the  DSILUS  routine.   See   the
 
42
C         "Description",  below for  more  details about  the   SLAP
 
43
C         format.  (NL is the number of non-zeros in the L array.)
 
44
C DINV   :IN       Double Precision DINV(N).
 
45
C         Inverse of the diagonal matrix D.
 
46
C IU     :IN       Integer IU(NU).
 
47
C JU     :IN       Integer JU(NU).
 
48
C U      :IN       Double Precision U(NU).
 
49
C         IU, JU, U contain the  unit upper triangular factor of the
 
50
C         incomplete  decomposition of some  matrix stored  in  SLAP
 
51
C         Column  format.   The diagonal of  ones *IS* stored.  This
 
52
C         structure can be set up by the  DSILUS routine.  See   the
 
53
C         "Description",  below for  more  details  about  the  SLAP
 
54
C         format.  (NU is the number of non-zeros in the U array.)
 
55
C
 
56
C *Description:
 
57
C       This routine is supplied with the SLAP package as  a routine
 
58
C       to  perform  the  MTSOLV  operation  in  the SBCG  iteration
 
59
C       routine for the  driver DSLUBC.   It must  be called via the
 
60
C       SLAP  MTSOLV calling  sequence convention interface  routine
 
61
C       DSLUTI.
 
62
C         **** THIS ROUTINE ITSELF DOES NOT CONFORM TO THE ****
 
63
C               **** SLAP MSOLVE CALLING CONVENTION ****
 
64
C
 
65
C       IL, JL, L should contain the unit lower triangular factor of
 
66
C       the incomplete decomposition of the A matrix  stored in SLAP
 
67
C       Row format.  IU, JU, U should contain  the unit upper factor
 
68
C       of the  incomplete decomposition of  the A matrix  stored in
 
69
C       SLAP Column format This ILU factorization can be computed by
 
70
C       the DSILUS routine. The diagonals (which are all one's) are
 
71
C       stored.
 
72
C
 
73
C       =================== S L A P Column format ==================
 
74
C
 
75
C       This routine  requires that  the matrix A  be stored in  the
 
76
C       SLAP Column format.  In this format the non-zeros are stored
 
77
C       counting down columns (except for  the diagonal entry, which
 
78
C       must appear first in each  "column")  and are stored  in the
 
79
C       double precision array A.   In other words,  for each column
 
80
C       in the matrix put the diagonal entry in  A.  Then put in the
 
81
C       other non-zero  elements going down  the column (except  the
 
82
C       diagonal) in order.   The  IA array holds the  row index for
 
83
C       each non-zero.  The JA array holds the offsets  into the IA,
 
84
C       A arrays  for  the  beginning  of each   column.   That  is,
 
85
C       IA(JA(ICOL)),  A(JA(ICOL)) points   to the beginning  of the
 
86
C       ICOL-th   column    in    IA and   A.      IA(JA(ICOL+1)-1),
 
87
C       A(JA(ICOL+1)-1) points to  the  end of the   ICOL-th column.
 
88
C       Note that we always have  JA(N+1) = NELT+1,  where N is  the
 
89
C       number of columns in  the matrix and NELT  is the number  of
 
90
C       non-zeros in the matrix.
 
91
C
 
92
C       Here is an example of the  SLAP Column  storage format for a
 
93
C       5x5 Matrix (in the A and IA arrays '|'  denotes the end of a
 
94
C       column):
 
95
C
 
96
C           5x5 Matrix      SLAP Column format for 5x5 matrix on left.
 
97
C                              1  2  3    4  5    6  7    8    9 10 11
 
98
C       |11 12  0  0 15|   A: 11 21 51 | 22 12 | 33 53 | 44 | 55 15 35
 
99
C       |21 22  0  0  0|  IA:  1  2  5 |  2  1 |  3  5 |  4 |  5  1  3
 
100
C       | 0  0 33  0 35|  JA:  1  4  6    8  9   12
 
101
C       | 0  0  0 44  0|
 
102
C       |51  0 53  0 55|
 
103
C
 
104
C       ==================== S L A P Row format ====================
 
105
C
 
106
C       This routine requires  that the matrix A  be  stored  in the
 
107
C       SLAP  Row format.   In this format  the non-zeros are stored
 
108
C       counting across  rows (except for the diagonal  entry, which
 
109
C       must  appear first  in each  "row")  and  are stored  in the
 
110
C       double precision  array A.  In other words, for each row  in
 
111
C       the matrix  put the diagonal  entry in A.   Then put in  the
 
112
C       other  non-zero elements  going across  the row  (except the
 
113
C       diagonal) in order.  The JA array holds the column index for
 
114
C       each non-zero.  The IA array holds the offsets  into the JA,
 
115
C       A  arrays  for  the   beginning  of  each  row.    That  is,
 
116
C       JA(IA(IROW)),A(IA(IROW)) are the first elements of the IROW-
 
117
C       th row in  JA and A,  and  JA(IA(IROW+1)-1), A(IA(IROW+1)-1)
 
118
C       are  the last elements  of the  IROW-th row.   Note  that we
 
119
C       always have  IA(N+1) = NELT+1, where N is the number of rows
 
120
C       in the matrix  and  NELT is the  number of non-zeros  in the
 
121
C       matrix.
 
122
C
 
123
C       Here is an example of the SLAP Row storage format for a  5x5
 
124
C       Matrix (in the A and JA arrays '|' denotes the end of a row):
 
125
C
 
126
C           5x5 Matrix         SLAP Row format for 5x5 matrix on left.
 
127
C                              1  2  3    4  5    6  7    8    9 10 11
 
128
C       |11 12  0  0 15|   A: 11 12 15 | 22 21 | 33 35 | 44 | 55 51 53
 
129
C       |21 22  0  0  0|  JA:  1  2  5 |  2  1 |  3  5 |  4 |  5  1  3
 
130
C       | 0  0 33  0 35|  IA:  1  4  6    8  9   12
 
131
C       | 0  0  0 44  0|
 
132
C       |51  0 53  0 55|
 
133
C
 
134
C       With  the SLAP  format  the "inner  loops" of  this  routine
 
135
C       should vectorize   on machines with   hardware  support  for
 
136
C       vector gather/scatter operations.  Your compiler may require
 
137
C       a  compiler directive  to  convince   it that there  are  no
 
138
C       implicit vector  dependencies.  Compiler directives  for the
 
139
C       Alliant FX/Fortran and CRI CFT/CFT77 compilers  are supplied
 
140
C       with the standard SLAP distribution.
 
141
C
 
142
C***SEE ALSO  DSILUS
 
143
C***REFERENCES  (NONE)
 
144
C***ROUTINES CALLED  (NONE)
 
145
C***REVISION HISTORY  (YYMMDD)
 
146
C   871119  DATE WRITTEN
 
147
C   881213  Previous REVISION DATE
 
148
C   890915  Made changes requested at July 1989 CML Meeting.  (MKS)
 
149
C   890922  Numerous changes to prologue to make closer to SLATEC
 
150
C           standard.  (FNF)
 
151
C   890929  Numerous changes to reduce SP/DP differences.  (FNF)
 
152
C   910411  Prologue converted to Version 4.0 format.  (BAB)
 
153
C   920511  Added complete declaration section.  (WRB)
 
154
C   921113  Corrected C***CATEGORY line.  (FNF)
 
155
C   930701  Updated CATEGORY section.  (FNF, WRB)
 
156
C***END PROLOGUE  DSLUI4
 
157
C     .. Scalar Arguments ..
 
158
      INTEGER N
 
159
C     .. Array Arguments ..
 
160
      DOUBLE PRECISION B(N), DINV(N), L(*), U(*), X(N)
 
161
      INTEGER IL(*), IU(*), JL(*), JU(*)
 
162
C     .. Local Scalars ..
 
163
      INTEGER I, ICOL, IROW, J, JBGN, JEND
 
164
C***FIRST EXECUTABLE STATEMENT  DSLUI4
 
165
      DO 10 I=1,N
 
166
         X(I) = B(I)
 
167
 10   CONTINUE
 
168
C
 
169
C         Solve  U'*Y = X,  storing result in X, U stored by columns.
 
170
      DO 80 IROW = 2, N
 
171
         JBGN = JU(IROW)
 
172
         JEND = JU(IROW+1) - 1
 
173
         IF( JBGN.LE.JEND ) THEN
 
174
CLLL. OPTION ASSERT (NOHAZARD)
 
175
CDIR$ IVDEP
 
176
CVD$ ASSOC
 
177
CVD$ NODEPCHK
 
178
            DO 70 J = JBGN, JEND
 
179
               X(IROW) = X(IROW) - U(J)*X(IU(J))
 
180
 70         CONTINUE
 
181
         ENDIF
 
182
 80   CONTINUE
 
183
C
 
184
C         Solve  D*Z = Y,  storing result in X.
 
185
      DO 90 I = 1, N
 
186
         X(I) = X(I)*DINV(I)
 
187
 90   CONTINUE
 
188
C
 
189
C         Solve  L'*X = Z, L stored by rows.
 
190
      DO 110 ICOL = N, 2, -1
 
191
         JBGN = IL(ICOL)
 
192
         JEND = IL(ICOL+1) - 1
 
193
         IF( JBGN.LE.JEND ) THEN
 
194
CLLL. OPTION ASSERT (NOHAZARD)
 
195
CDIR$ IVDEP
 
196
CVD$ NODEPCHK
 
197
            DO 100 J = JBGN, JEND
 
198
               X(JL(J)) = X(JL(J)) - L(J)*X(ICOL)
 
199
 100        CONTINUE
 
200
         ENDIF
 
201
 110  CONTINUE
 
202
      RETURN
 
203
C------------- LAST LINE OF DSLUI4 FOLLOWS ----------------------------
 
204
      END