Debian Codegraph @

F77/Source/Poisson2d/invers.f

raw symbols SCIP
1 C
2 C Copyright (c) 2000 Silvano Bonazzola
3 C
4 C This file is part of LORENE.
5 C
6 C LORENE is free software; you can redistribute it and/or modify
7 C it under the terms of the GNU General Public License as published by
8 C the Free Software Foundation; either version 2 of the License, or
9 C (at your option) any later version.
10 C
11 C LORENE is distributed in the hope that it will be useful,
12 C but WITHOUT ANY WARRANTY; without even the implied warranty of
13 C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 C GNU General Public License for more details.
15 C
16 C You should have received a copy of the GNU General Public License
17 C along with LORENE; if not, write to the Free Software
18 C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 C
20 C
21 SUBROUTINE INVERS(M,NM,A,EPS,E)
22 C
23 implicit double precision (a-h,o-z)
24
25 PARAMETER (N128=513)
26 C INVERSION D'UNE MATRICE CARRE PAR LA METHODE DES PIVOTS
27 C
28 C ARGUMENTS :
29 C
30 C M ORDRE DE LA MATRICE
31 C NM PREMIERE DIMENSION DU TABLEAU A
32 C A(NM,1) TABLEAU CONTENANT LA MATRICE A INVERSER EN ENTREE
33 C ET LA MATRICE INVERSE EN SORTIE
34 C EPS ERREUR MAXIMALE TOLEREE (ENTRE)
35 C E VALEUR DU DETERMINANT
36 C
37
38 C
39 C $Id: invers.f,v 1.2 2012/03/30 12:12:43 j_novak Exp $
40 C $Log: invers.f,v $
41 C Revision 1.2 2012/03/30 12:12:43 j_novak
42 C Cleaning of fortran files
43 C
44 C Revision 1.1.1.1 2001/11/20 15:19:30 e_gourgoulhon
45 C LORENE
46 C
47 c Revision 1.3 2000/11/28 15:08:22 nbib
48 c *** empty log message ***
49 c
50 c Revision 1.2 2000/11/28 15:03:22 nbib
51 c Correction probleme de FORMAT (label 1000, ligne 114) sous GNU g77.
52 c
53 c Revision 1.1 2000/10/23 14:40:59 nbib
54 c Initial revision
55 c
56 C
57 C $Header: /cvsroot/Lorene/F77/Source/Poisson2d/invers.f,v 1.2 2012/03/30 12:12:43 j_novak Exp $
58 C
59 C
60 character*120 header
61 data header/'$Header: /cvsroot/Lorene/F77/Source/Poisson2d/invers.f,v 1.2 2012/03/30 12:12:43 j_novak Exp $'/
62
63 INTEGER Q,S,R
64 DIMENSION A(NM,*),Q(N128),S(N128)
65 C
66 C
67 B(I,J)=A(I,J)
68 C
69 IF(M.GT.N128) THEN
70 PRINT*,'DIMENSIONS INSUFFISANTES DAN LA ROUTINE INVERS,M=',M
71 CALL EXIT
72 ENDIF
73 C
74 N=M
75 C INITIALIZE
76 D=1.
77 DO 1 I=1,N
78 1 Q(I)=I
79 C SEARCH FOR OPTIMAL PIVOTAL ELEMENT
80 DO 13 I=1,N
81 R=I
82 L=I
83 C=ABS(B(Q(I),Q(I)))
84 DO 5 J=I,N
85 DO 5 K=I,N
86 T=ABS(B(Q(J),Q(K)))
87 IF(.NOT.(C.LT.T))GO TO 5
88 R=J
89 L=K
90 C=T
91 5 CONTINUE
92 L1=L-1
93 R=Q(R)
94 L=Q(L)
95 IF(L1.LT.1) GOTO 70
96 DO 7 J=L1,I,-1
97 7 Q(J+1)=Q(J)
98 70 Q(I)=R
99 S(I)=L
100 C INTERCHANGE ROWS IN ORDER TO PLACE THE PIVOTAL ELEMENT ON THE
101 C MAIN DIAGONAL
102 IF(R.EQ.L)GO TO 9
103 D=-D
104 DO 8 J=1,N
105 T=A(R,J)
106 A(R,J)=A(L,J)
107 8 A(L,J)=T
108 9 T=A(L,L)
109 D=D*T
110 IF(C.LT.EPS)GO TO 20
111 T=1./T
112 A(L,L)=1.
113 C DIVIDE THE PIVOTAL ROW BY THE PIVOTAL ELEMENT
114 DO 10 J=1,N
115 10 A(L,J)=A(L,J)*T
116 C REDUCE NON PIVOTAL ROWS
117 L2=L-1
118 IF(L2.EQ.0) GOTO 121
119 L1=1
120 11 DO 12 J=L1,L2
121 T=A(J,L)
122 A(J,L)=0.
123 DO 12 K=1,N
124 12 A(J,K)=A(J,K)-A(L,K)*T
125 121 L1=L2+2
126 L2=N
127 IF(.NOT.(L1.GT.N))GO TO 11
128 13 CONTINUE
129 C INTERCHANGE COLUMNS
130 DO 16 J=N,1,-1
131 R=Q(J)
132 L=S(J)
133 IF(R.EQ.L) GOTO 16
134 DO 15 K=1,N
135 T=A(K,R)
136 A(K,R)=A(K,L)
137 15 A(K,L)=T
138 16 CONTINUE
139 18 E=D
140 RETURN
141 20 CONTINUE
142 D=0.
143 PRINT 1000,L,I,T
144 GO TO 18
145 1000 FORMAT(10X,'CICVERDE MATRICE SING. A L ADRESSE',I7,
146 1 ' PIVOT NR', I3, ' =',G14.8)
147 END