~ubuntu-branches/ubuntu/intrepid/cl-f2cl/intrepid

« back to all changes in this revision

Viewing changes to packages/hompack/solvds.f

  • Committer: Bazaar Package Importer
  • Author(s): Peter Van Eynde
  • Date: 2005-03-03 13:53:18 UTC
  • mfrom: (1.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050303135318-wpmxhzrts93qvs2o
Tags: 1.0+cvs.2005.03.03
New CVS release. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
      SUBROUTINE SOLVDS(NN,A,NWK,MAXA,V)
 
2
C
 
3
C     This subroutine solves a system of linear equations Bx=b, where
 
4
C     B is symmetric, and is represented by its LDU factorization.
 
5
C
 
6
C     Input variables:
 
7
C
 
8
C        NN  -- dimension of B.
 
9
C
 
10
C        A -- one dimensional real array containing the upper
 
11
C             triangular skyline portion of the LDU decomposition
 
12
C             of the symmetric matrix B.
 
13
C
 
14
C        NWK  -- number of elements in A.
 
15
C
 
16
C        MAXA -- an integer array of length NN+1 which contains the
 
17
C                location in A of the diagonal elements of B.
 
18
C                By convention, MAXA(NN+1) = NWK+1 .
 
19
C
 
20
C        V -- real array of length NN containing the vector b.
 
21
C
 
22
C
 
23
C     Output variables:
 
24
C
 
25
C        V -- solution of the system of equations B x = b .
 
26
C
 
27
C
 
28
C     No working storage is required by this routine.
 
29
C
 
30
      INTEGER K,KK,KL,KU,L,NN,MAXA(NN+1),N,NWK
 
31
      DOUBLE PRECISION A(NWK),C,V(NN)
 
32
      DO 180 N=1,NN
 
33
         KL=MAXA(N)+1
 
34
         KU=MAXA(N+1)-1
 
35
         IF(KU-KL)180,160,160
 
36
160      K=N
 
37
         C=0.0
 
38
         DO 170 KK=KL,KU
 
39
            K=K-1
 
40
            C=C+A(KK)*V(K)
 
41
170      CONTINUE
 
42
         V(N)=V(N)-C
 
43
180   CONTINUE
 
44
800   DO 480 N=1,NN
 
45
         K=MAXA(N)
 
46
         V(N)=V(N)/A(K)
 
47
480   CONTINUE
 
48
      IF (NN.EQ.1) RETURN
 
49
      N=NN
 
50
      DO 500 L=2,NN
 
51
         KL=MAXA(N) + 1
 
52
         KU=MAXA(N+1) - 1
 
53
         IF (KU-KL) 530,510,510
 
54
510      K=N
 
55
         DO 520 KK=KL,KU
 
56
            K=K - 1
 
57
            V(K)=V(K) - A(KK)*V(N)
 
58
520      CONTINUE
 
59
530      N=N - 1
 
60
500   CONTINUE
 
61
      RETURN
 
62
      END