~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to applic/fit/libsrc/gauss3d.for

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
C @(#)gauss3d.for       19.1 (ES0-DMD) 02/25/03 13:17:39
 
2
C===========================================================================
 
3
C Copyright (C) 1995 European Southern Observatory (ESO)
 
4
C
 
5
C This program is free software; you can redistribute it and/or 
 
6
C modify it under the terms of the GNU General Public License as 
 
7
C published by the Free Software Foundation; either version 2 of 
 
8
C the License, or (at your option) any later version.
 
9
C
 
10
C This program is distributed in the hope that it will be useful,
 
11
C but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
C GNU General Public License for more details.
 
14
C
 
15
C You should have received a copy of the GNU General Public 
 
16
C License along with this program; if not, write to the Free 
 
17
C Software Foundation, Inc., 675 Massachusetss Ave, Cambridge, 
 
18
C MA 02139, USA.
 
19
C
 
20
C Corresponding concerning ESO-MIDAS should be addressed as follows:
 
21
C       Internet e-mail: midas@eso.org
 
22
C       Postal address: European Southern Observatory
 
23
C                       Data Management Division 
 
24
C                       Karl-Schwarzschild-Strasse 2
 
25
C                       D 85748 Garching bei Muenchen 
 
26
C                       GERMANY
 
27
C===========================================================================
 
28
C
 
29
      SUBROUTINE GAUSS3(X,NP,PARAM,Y1,DERIV)                                   
 
30
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                  
 
31
C.COPYRIGHT: Copyright (c) 1987 European Southern Observatory,                  
 
32
C                                         all rights reserved                   
 
33
C                                                                               
 
34
C.VERSION: 1.0  ESO-FORTRAN Conversion, AA  18:01 - 21 DEC 1987                 
 
35
C                                                                               
 
36
C.LANGUAGE: F77+ESOext                                                          
 
37
C                                                                               
 
38
C.AUTHOR: J.D.PONZ                                                              
 
39
C                                                                               
 
40
C--------------------------------------------------------------                 
 
41
C**********************************************                                 
 
42
C                                                                               
 
43
C      IMPLICIT NONE                                                            
 
44
C   Three-dimensional Gaussian Distribution                                     
 
45
C                                                                               
 
46
C**********************************************                                 
 
47
C                                                                               
 
48
C   Author: O.-G. Richter, ESO Garching                                         
 
49
C                                                                               
 
50
      INTEGER NP
 
51
      DOUBLE PRECISION Y1,PARAM(NP),DERIV(NP)                                   
 
52
      REAL X(3)                                                            
 
53
      DOUBLE PRECISION R11,R22,R33,R12,R13,R23,R,R1                             
 
54
      DOUBLE PRECISION A,B,C,D,E,F,O,P,Q                                        
 
55
      DOUBLE PRECISION B2,C2,D2,B22,C22,D22,E1,E2,E3                            
 
56
C  !   \                                                                        
 
57
      R11    = 1.0D0 - PARAM(10)*PARAM(10)  !    > Diagonals                    
 
58
      R22    = 1.0D0 - PARAM(9)*PARAM(9)  !   /                                 
 
59
      R33    = 1.0D0 - PARAM(8)*PARAM(8)                                        
 
60
C      ! of correlation determ.  !   \                                          
 
61
      R12    = PARAM(9)*PARAM(10) - PARAM(8)  !    > Non-diagonals              
 
62
      R13    = PARAM(8)*PARAM(10) - PARAM(9)  !   /                             
 
63
      R23    = PARAM(8)*PARAM(9) - PARAM(10)                                    
 
64
C  !   Total residual dispersion                                                
 
65
      R      = 2.0D0*R12*PARAM(8) + R11 + R22 - 1.0  !   and its inverse        
 
66
      R1     = 1.0D0/R                                                          
 
67
C                                                                               
 
68
      A      = 0.6931471806D0*R1                                                
 
69
C                                                                               
 
70
      B      = (X(1)-PARAM(2))/PARAM(5)                                         
 
71
      C      = (X(2)-PARAM(3))/PARAM(6)                                         
 
72
      D      = (X(3)-PARAM(4))/PARAM(7)                                         
 
73
      B2     = B*B                                                              
 
74
      C2     = C*C                                                              
 
75
      D2     = D*D                                                              
 
76
      B22    = B2*R11                                                           
 
77
      C22    = C2*R22                                                           
 
78
      D22    = D2*R33                                                           
 
79
C                                                                               
 
80
      DERIV(1) = DEXP(-A* (B22+C22+D22+2.0* (B*C*R12+B*D*R13+C*D*R23)))         
 
81
C                                                                               
 
82
      Y1     = DERIV(1)*PARAM(1)                                                
 
83
      A      = 2.0*A*Y1                                                         
 
84
C                                                                               
 
85
      DERIV(2) = A* (B*R11+C*R12+D*R13)/PARAM(5)                                
 
86
      DERIV(3) = A* (B*R12+C*R22+D*R23)/PARAM(6)                                
 
87
      DERIV(4) = A* (B*R13+C*R23+D*R33)/PARAM(7)                                
 
88
      DERIV(5) = DERIV(2)*B                                                     
 
89
      DERIV(6) = DERIV(3)*C                                                     
 
90
      DERIV(7) = DERIV(4)*D                                                     
 
91
      A      = A*R1                                                             
 
92
      E      = 2.0*R12*R13                                                      
 
93
      E1     = E - PARAM(8)*R                                                   
 
94
      E2     = E - PARAM(9)*R                                                   
 
95
      E3     = E - PARAM(10)*R                                                  
 
96
      F      = B22 + C22 + D22                                                  
 
97
      O      = B*C                                                              
 
98
      P      = B*D                                                              
 
99
      Q      = C*D                                                              
 
100
C                                                                               
 
101
      DERIV(8) = A* (R12*F+D2*PARAM(8)*R+O* (2.0*R12*R12+R)+P*E3+Q*E2)          
 
102
      DERIV(9) = A* (R13*F+C2*PARAM(9)*R+O*E3+P* (2.0*R13*R13+R)+Q*E1)          
 
103
      DERIV(10) = A* (R23*F+B2*PARAM(10)*R+O*E2+P*E1+Q* (2.0*R23*R23+R))        
 
104
C                                                                               
 
105
      RETURN                                                                    
 
106
                                                                                
 
107
      END