1
C @(#)lsfun1i.for 19.1 (ES0-DMD) 02/25/03 13:17:40
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
C @(#)lsfun1i.for 2.1.1.1 (ESO-IPG) 9/27/91 18:10:00
30
SUBROUTINE LSFU1I(NRRES,NRPRM,PRM,FCTVEC,PIXEL,WEIGHT,IDIM1,
32
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
41
C Function to compute the approximating function at each point,
45
C Approximating Function.
48
C Read the TABLE row by row, and compute the fitting function by
49
C calling MIDAS functions
55
C CALL LSFUN1_I(NRRES,NRPRM,PRM,FCTVEC,PIXEL,WEIGHT,IDIM1,IDIM2,IDIM3)
58
C NRRES INTEGER Number of residuals
59
C NRPRM INTEGER Number of parameters
60
C PRM (NRPRM) DOUBLE Parameters
61
C PIXEL (IDIM_) REAL pixel values of the image
62
C WEIGHT (IDIM_) REAL weighting factors
63
C IDIM_ INTEGER dimension of the 3-dim image.
69
C FCTVEC (NRRES) DOUBLE Approximating values
78
C Ph. DEFERT, Feb 1986
82
C MODIF APR92 MP put correct coordinates of pixels !!!!!
83
C-----------------------------------------------------------------------
86
C .. Scalar Arguments ..
87
INTEGER NRPRM,NRRES,IDIM1,IDIM2,IDIM3,MADRID(1)
89
C .. Array Arguments ..
90
DOUBLE PRECISION FCTVEC(NRRES),PRM(NRPRM)
91
REAL PIXEL(IDIM1,IDIM2,IDIM3),WEIGHT(IDIM1,IDIM2,IDIM3)
93
C .. Scalars in Common ..
97
C .. Arrays in Common ..
100
C .. Local Scalars ..
101
DOUBLE PRECISION W,Y,Y1,YOUT,YY
102
INTEGER IFUN,K,BEGFCT,IP,I1,I2,I3,IPNT
105
DOUBLE PRECISION DUMMY(10)
108
C .. Common blocks ..
110
C .. External Files ..
111
INCLUDE 'MID_INCLUDE:FITNAGI.INC/NOLIST'
112
INCLUDE 'MID_INCLUDE:FITNAGC.INC/NOLIST'
114
COMMON /LSQFUN/ICOL,NRCOL,ISTAR,WGTTYP
116
C .. Executable Statements ..
118
C deal with simple linear constraints
122
IF (IP.EQ.0) PRM(K) = PARINI(K)
124
PRM(K) = PRM(IP)*PRPFAC(K)
130
C go through the all image
136
DO 50 I3 = 1,NRPIX(3)
138
DO 40 I2 = 1,NRPIX(2)
140
DO 30 I1 = 1,NRPIX(1)
147
IF (WGTTYP(1:1).EQ.'C') THEN
150
ELSE IF (WGTTYP(1:1).EQ.'W') THEN
153
ELSE IF (WGTTYP(1:1).EQ.'S') THEN
155
IF (YY.LT.1.E-12) THEN
162
ELSE IF (WGTTYP(1:1).EQ.'I') THEN
163
W = 1./WEIGHT(I1,I2,I3)**2
166
C Compute fitting values
171
CALL FTFUNC(FCTCOD(IFUN),NRIND,X,ACTPAR(IFUN),
172
+ PRM(BEGFCT),YOUT,DUMMY)
174
BEGFCT = BEGFCT + ACTPAR(IFUN)
176
FCTVEC(IPNT) = SQRT(W)* (Y1-Y)
177
X(1) = X(1) + STEP(1)
179
X(2) = X(2) + STEP(2)
181
X(3) = X(3) + STEP(3)