31 |
integer npoints !fit number of points |
integer npoints !fit number of points |
32 |
real dep(npoints),indep(npoints) !dependent and independent variables |
real dep(npoints),indep(npoints) !dependent and independent variables |
33 |
|
|
34 |
real angle(npoints) !angle between the tangent line in the input points and |
c real angle(npoints) !angle between the tangent line in the input points and |
35 |
|
c ! the independent variable axis |
36 |
|
c real residual(npoints) !residuals |
37 |
|
c real chi !sum of squared residuals |
38 |
|
c real xc,zc,radius !circle parameters |
39 |
|
double precision angle(npoints) !angle between the tangent line in the input points and |
40 |
! the independent variable axis |
! the independent variable axis |
41 |
|
double precision residual(npoints) !residuals EM GCC4.7 |
42 |
real residual(npoints) !residuals |
double precision chi !sum of squared residuals EM GCC4.7 |
43 |
real chi !sum of squared residuals |
double precision xc,zc,radius !circle parameters EM GCC4.7 |
|
real xc,zc,radius !circle parameters |
|
44 |
|
|
45 |
integer eflag !error flag =1 if the procedure fails |
integer eflag !error flag =1 if the procedure fails |
46 |
|
|
55 |
integer ifail !=-1 if singular matrix error, =0 if not singular |
integer ifail !=-1 if singular matrix error, =0 if not singular |
56 |
integer jfail !=0 if determinant can be evaluated, =-1 if determinat is probably too small, =+1 if too large |
integer jfail !=0 if determinant can be evaluated, =-1 if determinat is probably too small, =+1 if too large |
57 |
|
|
58 |
parameter (big=1.e4) !just a number greater than C(npoints,3) |
integer ibig ! EM GCC4.7 |
59 |
double precision xxc(big),zzc(big),rrr(big) !centres and radii to be averaged |
c parameter (ibig=1.e4) !just a number greater than C(npoints,3) |
60 |
|
parameter (ibig=10000) !just a number greater than C(npoints,3) EM GCC 4.7 |
61 |
|
double precision xxc(ibig),zzc(ibig),rrr(ibig) !centres and radii to be averaged |
62 |
|
|
63 |
double precision tmp1,tmp2,tmp(npoints) !temp variables |
double precision tmp1,tmp2,tmp(npoints) !temp variables |
64 |
|
|
65 |
|
logical DEBUG |
66 |
|
|
67 |
real pigr !3.1415... |
real pigr !3.1415... |
68 |
pigr=ACOS(-1.) |
pigr=ACOS(-1.) |
69 |
|
|
70 |
|
|
71 |
|
DEBUG = .false. |
72 |
|
if(eflag.eq.1)DEBUG = .true. |
73 |
|
|
74 |
eflag = 0 |
eflag = 0 |
75 |
|
|
76 |
|
|
147 |
jfail=0 |
jfail=0 |
148 |
call DFACT(3,a,3,ir,ifail,deta,jfail) |
call DFACT(3,a,3,ir,ifail,deta,jfail) |
149 |
if(ifail.eq.-1) then |
if(ifail.eq.-1) then |
150 |
print*,'tricircle: ERROR: singular matrix A:' |
if(DEBUG)then |
151 |
do i=1,3 |
print*,'tricircle: ERROR: singular matrix A:' |
152 |
print*,(a(i,j),j=1,3) |
do i=1,3 |
153 |
enddo |
print*,(a(i,j),j=1,3) |
154 |
|
enddo |
155 |
|
endif |
156 |
eflag=1 |
eflag=1 |
157 |
endif |
endif |
158 |
if(jfail.eq.-1) then |
if(jfail.eq.-1) then |
159 |
print* |
if(DEBUG)then |
160 |
$ ,'tricircle: ERROR: matrix A: determinant too small?' |
print* |
161 |
do i=1,3 |
$ ,'tricircle: ERROR: matrix A: determinant too small?' |
162 |
print*,(d(i,j),j=1,3) |
do i=1,3 |
163 |
enddo |
print*,(d(i,j),j=1,3) |
164 |
|
enddo |
165 |
|
endif |
166 |
eflag=1 |
eflag=1 |
167 |
elseif(jfail.eq.1) then |
elseif(jfail.eq.1) then |
168 |
print* |
if(DEBUG)then |
169 |
|
print* |
170 |
$ ,'tricircle: ERROR: matrix A: determinant too large?' |
$ ,'tricircle: ERROR: matrix A: determinant too large?' |
171 |
do i=1,3 |
do i=1,3 |
172 |
print*,(d(i,j),j=1,3) |
print*,(d(i,j),j=1,3) |
173 |
enddo |
enddo |
174 |
|
endif |
175 |
eflag=1 |
eflag=1 |
176 |
endif |
endif |
177 |
|
|
179 |
jfail=0 |
jfail=0 |
180 |
call DFACT(3,d,3,ir,ifail,detd,jfail) |
call DFACT(3,d,3,ir,ifail,detd,jfail) |
181 |
if(ifail.eq.-1) then |
if(ifail.eq.-1) then |
182 |
print*,'tricircle: ERROR: singular matrix D:' |
if(DEBUG)then |
183 |
do i=1,3 |
print*,'tricircle: ERROR: singular matrix D:' |
184 |
print*,(d(i,j),j=1,3) |
do i=1,3 |
185 |
enddo |
print*,(d(i,j),j=1,3) |
186 |
eflag=1 |
enddo |
187 |
endif |
endif |
188 |
if(jfail.eq.-1) then |
eflag=1 |
189 |
print* |
endif |
190 |
$ ,'tricircle: ERROR: matrix D: determinant too small?' |
if(jfail.eq.-1) then |
191 |
do i=1,3 |
if(DEBUG)then |
192 |
print*,(d(i,j),j=1,3) |
print* |
193 |
enddo |
$ ,'tricircle: ERROR: matrix D: determinant too small?' |
194 |
|
do i=1,3 |
195 |
|
print*,(d(i,j),j=1,3) |
196 |
|
enddo |
197 |
|
endif |
198 |
eflag=1 |
eflag=1 |
199 |
elseif(jfail.eq.1) then |
elseif(jfail.eq.1) then |
200 |
|
if(DEBUG)then |
201 |
print* |
print* |
202 |
$ ,'tricircle: ERROR: matrix D: determinant too large?' |
$ ,'tricircle: ERROR: matrix D: determinant too large?' |
203 |
do i=1,3 |
do i=1,3 |
204 |
print*,(d(i,j),j=1,3) |
print*,(d(i,j),j=1,3) |
205 |
enddo |
enddo |
206 |
|
endif |
207 |
eflag=1 |
eflag=1 |
208 |
endif |
endif |
209 |
|
|
211 |
jfail=0 |
jfail=0 |
212 |
call DFACT(3,e,3,ir,ifail,dete,jfail) |
call DFACT(3,e,3,ir,ifail,dete,jfail) |
213 |
if(ifail.eq.-1) then |
if(ifail.eq.-1) then |
214 |
|
if(DEBUG)then |
215 |
print*,'tricircle: ERROR: singular matrix E:' |
print*,'tricircle: ERROR: singular matrix E:' |
216 |
do i=1,3 |
do i=1,3 |
217 |
print*,(e(i,j),j=1,3) |
print*,(e(i,j),j=1,3) |
218 |
enddo |
enddo |
219 |
|
endif |
220 |
eflag=1 |
eflag=1 |
221 |
endif |
endif |
222 |
if(jfail.eq.-1) then |
if(jfail.eq.-1) then |
223 |
|
if(DEBUG)then |
224 |
print* |
print* |
225 |
$ ,'tricircle: ERROR: matrix E: determinant too small?' |
$ ,'tricircle: ERROR: matrix E: determinant too small?' |
226 |
do i=1,3 |
do i=1,3 |
227 |
print*,(e(i,j),j=1,3) |
print*,(e(i,j),j=1,3) |
228 |
enddo |
enddo |
229 |
|
endif |
230 |
eflag=1 |
eflag=1 |
231 |
elseif(jfail.eq.1) then |
elseif(jfail.eq.1) then |
232 |
|
if(DEBUG)then |
233 |
print* |
print* |
234 |
$ ,'tricircle: ERROR: matrix E: determinant too large?' |
$ ,'tricircle: ERROR: matrix E: determinant too large?' |
235 |
do i=1,3 |
do i=1,3 |
236 |
print*,(e(i,j),j=1,3) |
print*,(e(i,j),j=1,3) |
237 |
enddo |
enddo |
238 |
|
endif |
239 |
eflag=1 |
eflag=1 |
240 |
endif |
endif |
241 |
|
|
244 |
call DFACT(3,f,3,ir,ifail,detf,jfail) |
call DFACT(3,f,3,ir,ifail,detf,jfail) |
245 |
c ifail=-1 !??? |
c ifail=-1 !??? |
246 |
if(ifail.eq.-1) then |
if(ifail.eq.-1) then |
247 |
|
if(DEBUG)then |
248 |
print*,'tricircle: ERROR: singular matrix F:' |
print*,'tricircle: ERROR: singular matrix F:' |
249 |
do i=1,3 |
do i=1,3 |
250 |
print*,(f(i,j),j=1,3) |
print*,(f(i,j),j=1,3) |
251 |
enddo |
enddo |
252 |
|
endif |
253 |
eflag=1 |
eflag=1 |
254 |
endif |
endif |
255 |
if(jfail.eq.-1) then |
if(jfail.eq.-1) then |
256 |
|
if(DEBUG)then |
257 |
print* |
print* |
258 |
$ ,'tricircle: ERROR: matrix F: determinant too small?' |
$ ,'tricircle: ERROR: matrix F: determinant too small?' |
259 |
do i=1,3 |
do i=1,3 |
260 |
print*,(f(i,j),j=1,3) |
print*,(f(i,j),j=1,3) |
261 |
enddo |
enddo |
262 |
|
endif |
263 |
eflag=1 |
eflag=1 |
264 |
elseif(jfail.eq.1) then |
elseif(jfail.eq.1) then |
265 |
|
if(DEBUG)then |
266 |
print* |
print* |
267 |
$ ,'tricircle: ERROR: matrix F: determinant too large?' |
$ ,'tricircle: ERROR: matrix F: determinant too large?' |
268 |
do i=1,3 |
do i=1,3 |
269 |
print*,(f(i,j),j=1,3) |
print*,(f(i,j),j=1,3) |
270 |
enddo |
enddo |
271 |
|
endif |
272 |
eflag=1 |
eflag=1 |
273 |
endif |
endif |
274 |
|
|