~ubuntu-branches/ubuntu/karmic/python-scipy/karmic

« back to all changes in this revision

Viewing changes to Lib/integrate/odepack/mdi.f

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T. Chen (new)
  • Date: 2005-03-16 02:15:29 UTC
  • Revision ID: james.westby@ubuntu.com-20050316021529-xrjlowsejs0cijig
Tags: upstream-0.3.2
ImportĀ upstreamĀ versionĀ 0.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
      subroutine mdi
 
2
     *     (n, ia,ja, max,v,l, head,last,next, mark,tag, flag)
 
3
clll. optimize
 
4
c***********************************************************************
 
5
c  mdi -- initialization
 
6
c***********************************************************************
 
7
      integer  ia(1), ja(1),  v(1), l(1),  head(1), last(1), next(1),
 
8
     *   mark(1), tag,  flag,  sfs, vi,dvi, vj
 
9
c
 
10
c----initialize degrees, element lists, and degree lists
 
11
      do 1 vi=1,n
 
12
        mark(vi) = 1
 
13
        l(vi) = 0
 
14
   1    head(vi) = 0
 
15
      sfs = n+1
 
16
c
 
17
c----create nonzero structure
 
18
c----for each nonzero entry a(vi,vj)
 
19
      do 6 vi=1,n
 
20
        jmin = ia(vi)
 
21
        jmax = ia(vi+1) - 1
 
22
        if (jmin.gt.jmax)  go to 6
 
23
        do 5 j=jmin,jmax
 
24
          vj = ja(j)
 
25
          if (vj-vi) 2, 5, 4
 
26
c
 
27
c------if a(vi,vj) is in strict lower triangle
 
28
c------check for previous occurrence of a(vj,vi)
 
29
   2      lvk = vi
 
30
          kmax = mark(vi) - 1
 
31
          if (kmax .eq. 0) go to 4
 
32
          do 3 k=1,kmax
 
33
            lvk = l(lvk)
 
34
            if (v(lvk).eq.vj) go to 5
 
35
   3        continue
 
36
c----for unentered entries a(vi,vj)
 
37
   4        if (sfs.ge.max)  go to 101
 
38
c
 
39
c------enter vj in element list for vi
 
40
            mark(vi) = mark(vi) + 1
 
41
            v(sfs) = vj
 
42
            l(sfs) = l(vi)
 
43
            l(vi) = sfs
 
44
            sfs = sfs+1
 
45
c
 
46
c------enter vi in element list for vj
 
47
            mark(vj) = mark(vj) + 1
 
48
            v(sfs) = vi
 
49
            l(sfs) = l(vj)
 
50
            l(vj) = sfs
 
51
            sfs = sfs+1
 
52
   5      continue
 
53
   6    continue
 
54
c
 
55
c----create degree lists and initialize mark vector
 
56
      do 7 vi=1,n
 
57
        dvi = mark(vi)
 
58
        next(vi) = head(dvi)
 
59
        head(dvi) = vi
 
60
        last(vi) = -dvi
 
61
        nextvi = next(vi)
 
62
        if (nextvi.gt.0)  last(nextvi) = vi
 
63
   7    mark(vi) = tag
 
64
c
 
65
      return
 
66
c
 
67
c ** error-  insufficient storage
 
68
 101  flag = 9*n + vi
 
69
      return
 
70
      end