source: Sophya/trunk/SophyaExt/CodeMinuit/code/mnvert.F

Last change on this file was 2403, checked in by cmv, 22 years ago

Creation du module de code source de MINUIT (CERNLIB) extrait par CMV

cmv 11/06/2003

File size: 2.3 KB
RevLine 
[2403]1*
2* $Id: mnvert.F,v 1.1.1.1 2003-06-11 14:18:30 cmv Exp $
3*
4* $Log: not supported by cvs2svn $
5* Revision 1.2 1996/03/15 18:02:54 james
6* Modified Files:
7* mnderi.F eliminate possible division by zero
8* mnexcm.F suppress print on STOP when print flag=-1
9* set FVAL3 to flag if FCN already called with IFLAG=3
10* mninit.F set version 96.03
11* mnlims.F remove arguments, not needed
12* mnmigr.F VLEN -> LENV in debug print statement
13* mnparm.F move call to MNRSET to after NPAR redefined, to zero all
14* mnpsdf.F eliminate possible division by zero
15* mnscan.F suppress printout when print flag =-1
16* mnset.F remove arguments in call to MNLIMS
17* mnsimp.F fix CSTATU so status is PROGRESS only if new minimum
18* mnvert.F eliminate possible division by zero
19*
20* Revision 1.1.1.1 1996/03/07 14:31:32 mclareni
21* Minuit
22*
23*
24#include "minuit/pilot.h"
25 SUBROUTINE MNVERT(A,L,M,N,IFAIL)
26#include "minuit/d506dp.inc"
27CC inverts a symmetric matrix. matrix is first scaled to
28CC have all ones on the diagonal (equivalent to change of units)
29CC but no pivoting is done since matrix is positive-definite.
30CC
31#include "minuit/d506cm.inc"
32 DIMENSION A(L,M) ,PP(MNI), Q(MNI), S(MNI)
33 IFAIL=0
34 IF (N .LT. 1) GO TO 100
35 IF (N .GT. MAXINT) GO TO 100
36C scale matrix by sqrt of diag elements
37 DO 8 I=1,N
38 SI = A(I,I)
39 IF (SI) 100,100,8
40 8 S(I) = 1.0/SQRT(SI)
41 DO 20 I= 1, N
42 DO 20 J= 1, N
43 20 A(I,J) = A(I,J) *S(I)*S(J)
44C . . . start main loop . . . .
45 DO 65 I=1,N
46 K = I
47C preparation for elimination step1
48 IF (A(K,K) .EQ. ZERO) GO TO 100
49 Q(K)=1./A(K,K)
50 PP(K) = 1.0
51 A(K,K)=0.0
52 KP1=K+1
53 KM1=K-1
54 IF(KM1)100,50,40
55 40 DO 49 J=1,KM1
56 PP(J)=A(J,K)
57 Q(J)=A(J,K)*Q(K)
58 49 A(J,K)=0.
59 50 IF(K-N)51,60,100
60 51 DO 59 J=KP1,N
61 PP(J)=A(K,J)
62 Q(J)=-A(K,J)*Q(K)
63 59 A(K,J)=0.0
64C elimination proper
65 60 DO 65 J=1,N
66 DO 65 K=J,N
67 65 A(J,K)=A(J,K)+PP(J)*Q(K)
68C elements of left diagonal and unscaling
69 DO 70 J= 1, N
70 DO 70 K= 1, J
71 A(K,J) = A(K,J) *S(K)*S(J)
72 70 A(J,K) = A(K,J)
73 RETURN
74C failure return
75 100 IFAIL=1
76 RETURN
77 END
Note: See TracBrowser for help on using the repository browser.