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

« back to all changes in this revision

Viewing changes to contrib/surfphot/libsrc/syst.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 @(#)syst.for  19.1 (ES0-DMD) 02/25/03 13:30:49
 
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 SYST(N,A,C,JER)                                                
 
30
C +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     
 
31
C.PURPOSE: System solution for polynomial of degree ideg=(sqrt(8*n+1)-2)/2      
 
32
C ----------------------------------------------------------------------        
 
33
      IMPLICIT         NONE
 
34
      INTEGER          N
 
35
      DOUBLE PRECISION A(21,22)
 
36
      DOUBLE PRECISION C(21)
 
37
      INTEGER          JER
 
38
C
 
39
      DOUBLE PRECISION B,P 
 
40
      INTEGER          I, I1
 
41
      INTEGER          K
 
42
      INTEGER          L
 
43
      INTEGER          J, J1
 
44
      INTEGER          N1, N2
 
45
                                                                                
 
46
      N1 = N - 1                                                                
 
47
      N2 = N + 1                                                                
 
48
      DO 60 I = 1,N1                                                            
 
49
         B      = DABS(A(I,I))                                                  
 
50
         I1     = I + 1                                                         
 
51
         K      = I                                                             
 
52
                                                                                
 
53
         DO 10 J = I1,N                                                         
 
54
            IF (B.GT.DABS(A(J,I))) GO TO 10                                     
 
55
            B      = DABS(A(J,I))                                               
 
56
            K      = J                                                          
 
57
   10    CONTINUE                                                               
 
58
         IF (B.EQ.0.0D0) GO TO 90                                               
 
59
         IF (K.EQ.I) GO TO 30                                                   
 
60
                                                                                
 
61
         DO 20 J = I,N2                                                         
 
62
            P      = A(K,J)                                                     
 
63
            A(K,J) = A(I,J)                                                     
 
64
            A(I,J) = P                                                          
 
65
   20    CONTINUE                                                               
 
66
                                                                                
 
67
   30    DO 50 J = I,N1                                                         
 
68
            J1     = J + 1                                                      
 
69
            P      = A(J1,I)/A(I,I)                                             
 
70
            DO 40 L = I1,N2                                                     
 
71
               A(J1,L) = A(J1,L) - P*A(I,L)                                     
 
72
   40       CONTINUE                                                            
 
73
   50    CONTINUE                                                               
 
74
   60 CONTINUE                                                                  
 
75
                                                                                
 
76
      IF (A(N,N).EQ.0.0D0) GO TO 90                                             
 
77
      C(N)   = A(N,N2)/A(N,N)                                                   
 
78
      DO 80 I = 1,N1                                                            
 
79
         J      = N - I                                                         
 
80
         P      = A(J,N2)                                                       
 
81
         DO 70 L = 1,I                                                          
 
82
            K      = N2 - L                                                     
 
83
            P      = P - C(K)*A(J,K)                                            
 
84
   70    CONTINUE                                                               
 
85
         C(J)   = P/A(J,J)                                                      
 
86
   80 CONTINUE                                                                  
 
87
                                                                                
 
88
      JER    = 0                                             ! no error         
 
89
      RETURN                                                                    
 
90
                                                                                
 
91
   90 CONTINUE                                                                  
 
92
      JER    = 1                                             ! error return     
 
93
      RETURN                                                                    
 
94
                                                                                
 
95
      END