1
C @(#)funct1i.for 19.1 (ES0-DMD) 02/25/03 13:17:37
2
C===========================================================================
3
C Copyright (C) 1995 European Southern Observatory (ESO)
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.
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.
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,
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
27
C===========================================================================
29
SUBROUTINE FUNC1I(NRPRM,PRM,FCT,PIXEL,WEIGHT,IDIM1,IDIM2,IDIM3)
30
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
39
C Function to compute the sum of residuals
43
C Approximating Function.
46
C Read the TABLE row by row, and compute the fitting function by
47
C calling MIDAS functions
53
C CALL FUNC1I(NRPRM,PRM,FCT,PIXEL,WEIGHT,IDIM1,IDIM2,IDIM3)
56
C NRPRM INTEGER Number of parameters
57
C PRM (NRPRM) DOUBLE Parameters
58
C PIXEL (IDIM_) REAL pixel values of the image
59
C WEIGHT (IDIM_) REAL weighting factors
60
C IDIM_ INTEGER dimension of the 3-dim image.
66
C FCT DOUBLE Sum of residuals
75
C Ph. DEFERT, Feb 1986
80
C-----------------------------------------------------------------------
83
C .. Scalar Arguments ..
84
INTEGER NRPRM,IDIM1,IDIM2,IDIM3
87
C .. Array Arguments ..
88
DOUBLE PRECISION PRM(NRPRM)
89
REAL PIXEL(IDIM1,IDIM2,IDIM3),WEIGHT(IDIM1,IDIM2,IDIM3)
91
C .. Scalars in Common ..
95
C .. Arrays in Common ..
99
DOUBLE PRECISION W,Y,Y1,YOUT,YY
100
INTEGER IFUN,K,BEGFCT,I1,I2,I3,IP
103
DOUBLE PRECISION DUMMY(10)
106
C .. External Files ..
107
INCLUDE 'MID_INCLUDE:FITNAGI.INC/NOLIST'
108
INCLUDE 'MID_INCLUDE:FITNAGC.INC/NOLIST'
110
C .. Common blocks ..
111
COMMON /LSQFUN/ICOL,NRCOL,ISTAR,WGTTYP
113
C .. Executable Statements ..
115
C deal with linear simple constraints
120
PRM(K) = PRM(IP)*PRPFAC(K)
126
C Go through the image
139
IF (WGTTYP(1:1).EQ.'C') THEN
142
ELSE IF (WGTTYP(1:1).EQ.'W') THEN
145
ELSE IF (WGTTYP(1:1).EQ.'S') THEN
147
IF (YY.LT.1.E-12) THEN
154
ELSE IF (WGTTYP(1:1).EQ.'I') THEN
155
W = 1./WEIGHT(I1,I2,I3)**2
158
C Compute fitting values
163
CALL FTFUNC(FCTCOD(IFUN),NRIND,X,ACTPAR(IFUN),
164
+ PRM(BEGFCT),YOUT,DUMMY)
166
BEGFCT = BEGFCT + ACTPAR(IFUN)
168
FCT = FCT + W* (Y1-Y)**2
169
X(1) = X(1) + STEP(1)
171
X(2) = X(2) + STEP(2)
173
X(3) = X(3) + STEP(3)