KTH framework for Nek5000 toolboxes; testing version  0.0.1
gauss.f
Go to the documentation of this file.
1  SUBROUTINE lu(A,N,ldim,IR,IC)
2 C IT IS THE FIRST SUBROUTINE TO COMPUTE THE MX. INV.
3  dimension a(ldim,1),ir(1),ic(1)
4  DO 10i=1,n
5  ir(i)=i
6  ic(i)=i
7 10 CONTINUE
8  k=1
9  l=k
10  m=k
11  xmax=abs(a(k,k))
12  DO 100i=k,n
13  DO 100j=k,n
14  y=abs(a(i,j))
15  IF(xmax.GE.y) GOTO 100
16  xmax=y
17  l=i
18  m=j
19 100 CONTINUE
20  DO 1000k=1,n
21  irl=ir(l)
22  ir(l)=ir(k)
23  ir(k)=irl
24  icm=ic(m)
25  ic(m)=ic(k)
26  ic(k)=icm
27  IF(l.EQ.k) GOTO 300
28  DO 200j=1,n
29  b=a(k,j)
30  a(k,j)=a(l,j)
31  a(l,j)=b
32 200 CONTINUE
33 300 IF(m.EQ.k) GOTO 500
34  DO 400i=1,n
35  b=a(i,k)
36  a(i,k)=a(i,m)
37  a(i,m)=b
38 400 CONTINUE
39 500 c=1./a(k,k)
40  a(k,k)=c
41  IF(k.EQ.n) GOTO 1000
42  k1=k+1
43  xmax=abs(a(k1,k1))
44  l=k1
45  m=k1
46  DO 600i=k1,n
47  a(i,k)=c*a(i,k)
48 600 CONTINUE
49  DO 800i=k1,n
50  b=a(i,k)
51  DO 800j=k1,n
52  a(i,j)=a(i,j)-b*a(k,j)
53  y=abs(a(i,j))
54  IF(xmax.GE.y) GOTO 800
55  xmax=y
56  l=i
57  m=j
58 800 CONTINUE
59 1000 CONTINUE
60  RETURN
61  END
62  SUBROUTINE solve(F,A,K,N,ldim,IR,IC)
63 C IT IS THE SECOND PART OF THE MATRIX INVERSION
64  dimension a(ldim,1),f(ldim,1),ir(1),ic(1)
65  COMMON /ctmpg/ g(2000)
66 C
67 C
68  IF (n.GT.2000) THEN
69  write(6,*) 'Abort IN Subrtouine SOLVE: N>2000, N=',n
70  call exitt
71  ENDIF
72 C
73  n1=n+1
74  DO 1000kk=1,k
75  DO 100i=1,n
76  iri=ir(i)
77  g(i)=f(iri,kk)
78 100 CONTINUE
79  DO 400i=2,n
80  i1=i-1
81  b=g(i)
82  DO 300j=1,i1
83  b=b-a(i,j)*g(j)
84 300 CONTINUE
85  g(i)=b
86 400 CONTINUE
87  DO 700it=1,n
88  i=n1-it
89  i1=i+1
90  b=g(i)
91  IF(i.EQ.n) GOTO 701
92  DO 600j=i1,n
93  b=b-a(i,j)*g(j)
94 600 CONTINUE
95 701 g(i)=b*a(i,i)
96 700 CONTINUE
97  DO 900i=1,n
98  ici=ic(i)
99  f(ici,kk)=g(i)
100 900 CONTINUE
101 1000 CONTINUE
102  RETURN
103  END
void exitt()
Definition: comm_mpi.f:604
subroutine solve(F, A, K, N, ldim, IR, IC)
Definition: gauss.f:63
subroutine lu(A, N, ldim, IR, IC)
Definition: gauss.f:2