MATLAB_STEPIT
|
README.txt,
STEPIT10.m,
STEPITDRIVER2.m,
private_110_ROUTINE.m,
private_140_ROUTINE.m,
private_210_ROUTINE.m,
private_290_ROUTINE.m,
private_380_ROUTINE.m,
private_390_ROUTINE.m,
private_530_ROUTINE.m,
private_570_ROUTINE.m,
private_90_ROUTINE.m,
private_FORLOOP_ROUTINE1.m,
private_FUNK.m,
private_KFLAG_EXIT.m,
private_STBEG2.m,
private_STSET.m,
x1.txt,
x2.txt,
y.txt,
ysig.txt
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% private_390_ROUTINE -- A routine very similar to private_380_ROUTINE; called by STEPIT
%
% Written by Jason Lott, University of Alabama at Birmingham
% CONTACT: hoffa@uab.edu
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function a = private_390_ROUTINE(b)
global X
global XMAX
global XMIN
global DELTX
global DELMIN
global ERR
global FOBJ
global VEC
global DLX
global XS
global FSTORE
global DX
global SALVO
global XOSC
global FOSC
global ARG
global STCUT
global ACK
global FACUP
global RZERO
global XPLUS
global FSAVE
global FBEST
global XSAVE
global ABSDX
global FPREV
global DENOM
global DEL
global DXZ
global DXU
global DFZ
global DFU
global ABSVEC
global SUMV
global CINDER
global COXCOM
global COSIN
global STEPS
global J
global JFLAT
global JFLMIN
global JOCK
global JUMP
global JVARY
global JX
global K
global KERFEL
global KL
global KW
global MASK
global MATRX
global MINSOC
global MAXOSC
global MAXSTP
global NACK
global NACTIV
global NAH
global NCIRC
global NEQUAL
global NF
global NFLAT
global NFMAX
global NFSAV
global NGATE
global NGIANT
global NONZER
global NOREP
global NOSC
global NOUT
global NRETRY
global NSSW
global NSTEPS
global NT
global NTRACE
global NV
global NEXTRA
global NZIP
global tag_380
global tag_390
global wtag
global tag
global continueflag
global T
global Y
global YSIG
global grandtag
global KFLAG
global DLX
global DX
global XS
global fortag
global KFLAGENCOUNTER
tag_390 = 1;
while tag_390 == 1
NRETRY = -1;
NGIANT = 0;
NFSAV = NF;
tag+400 = 1;
while tag_400 == 1
for J=1:NV
XS(J) = X(J);
if MASK(J)~=0
else
X(J) = X(J) + DLX(J);
if X(J)>XMAX(J)
X(J) = XMAX(J);
end
if X(J)=FBEST
if NGIANT<=0
for J=1:NV
if NRETRY>=0
DLX(J) = SALVO(J);
end
X(J) = XS(J);
end
if NTRACE>=1
disp('FOBJ= '),disp(FOBJ),disp(' AFTER '),disp(NGIANT),disp('GIANT STEPS')
end
if NGIANT>0
tag_390 = 0; %break out of 390 while loop
NCIRC = 0; %CALL TO 640 ROUTINE!!!!!
NZIP = 0;
NACK = 0;
grandtag =1;
fortag = 0;
elseif NRETRY>0
if KL>NAH
%disp('ENTERING 380 from 390 1')
%pause
private_380_ROUTINE(1); %Enter 380 routine
tag_400 = 0; %Break out of 400 LOOP
tag_390 = 0; %Ensures that I break out of 390routine after exiting from 380routine
else
tag = 1;
for K=KL:NAH
if tag == 1
NRETRY = NAH - K;
COSIN = RZERO;
for J=1:NV
COSIN = COSIN + ERR(J,NOSC)*ERR(J,K);
end
if (K>=(NOSC-1))||((COSIN>RZERO)&(COSIN>COXOM))
KL = KL+1;
NT = NOSC-K;
if NTRACE>=1
disp('*****GIGANTIC STEP WITH PERIOD '),disp(NT),disp(' BEING ATTEMPTED.')
disp('COXCOM= '),disp(COXCOM)
disp('COSIN= '), disp(COSIN)
end
for J=1:NV
SALVO(J) = DLX(J);
DLX(J) = X(J)-XOSC(J,K);
end
FPREV = FOSC(K);
tag_390 = 1; %stay in 390 loop, accomplished with tag=0 and very next IF statement below
tag = 0;
end
end
end
if tag == 0
tag_400 = 0 %Break out of the 400 LOOP
tag_390 = 1; %ARRR! Stay in tha 390 loop, matey
else
%disp('ENTERING 380 from 390 2')
%pause
private_380_ROUTINE(1); %Enter 380 loop
tag_400 = 0; %Break out of the 400 LOOP
tag_390 = 1; %Ensures that I break out of 390routine after exiting 380routine
end
end
elseif NRETRY == 0
%disp('ENTERING 380 from 390 3')
%pause
private_380_ROUTINE(1) %Enter 380 loop
tag_400 = 0; %Break out of the 400 LOOP
tag_390 = 0; %ENsures that I break out of 390routine after exiting 380routine
else
NOSC = NOSC -1;
if NOSC<0
NOSC = 0;
end
FSTORE(JX) = FBEST;
if NF>NFMAX
KFLAG = -2;
%disp('ENTERING KFLAG EXIT from 390 1')
%pause
private_KFLAG_EXIT(KFLAG);
tag_400 = 0; %Break out of 400 LOOP after KFLAG
tag_390 = 0; %Break out of 390 LOOP, to ensure a clean program exit
else
tag_400 = 0;
tag_390 = 0; %%Kicks me out of 390 routine, truly stay in big FOR LOOP
end
end
else %%Perform quadratic interpolation
DENOM = ACK*(FPREV-FBEST) - (FBEST-FOBJ);
if DENOM<=RZERO
for J=1:NV
if NRETRY>=0
DLX(J) = SALVO(J);
end
X(J) = XS(J);
end
if NTRACE>=1
disp('FOBJ= '),disp(FOBJ),disp(' AFTER '),disp(NGIANT),disp('GIANT STEPS')
end
if NGIANT>0
tag_390 = 0; %break out of 390 while loop
tag_400 = 0;
NCIRC = 0; %CALL TO 640 ROUTINE!!!!
NZIP = 0;
NACK = 0;
grandtag =1;
fortag = 0;
elseif NRETRY>0
if KL>NAH
% disp('ENTERING 380 from 390 4')
% pause
private_380_ROUTINE(1)
tag_390 = 0; %Ensures that I break out of 390 routine after exiting from 380 routine
tag_400 = 0;
else
tag = 1;
for K=KL:NAH
if tag == 1
NRETRY = NAH - K;
COSIN = RZERO;
for J=1:NV
COSIN = COSIN + ERR(J,NOSC)*ERR(J,K);
end
if (K>=(NOSC-1))||((COSIN>RZERO)&(COSIN>COXOM))
KL = KL+1;
NT = NOSC-K;
if NTRACE>=1
disp('*****GIGANTIC STEP WITH PERIOD '),disp(NT),disp(' BEING ATTEMPTED.')
disp('COXCOM= '),disp(COXCOM)
disp('COSIN= '), disp(COSIN)
end
for J=1:NV
SALVO(J) = DLX(J);
DLX(J) = X(J)-XOSC(J,K);
end
FPREV = FOSC(K);
tag_390 = 1; %stay in 390 loop, accomplished with tag=0 and very next IF statement below
tag = 0
end
end
end
if tag == 0
tag_390 = 1; %ARRR! Stay in tha 390 loop, matey
tag_400 = 0;
else
%disp('ENTERING 380 from 390 5')
%pause
private_380_ROUTINE(1)
tag_390 = 0; %Ensures that I break out of 390 loop after exiting 380routine
tag_400 = 0;
end
end
elseif NRETRY == 0
private_380_ROUTINE(1)
%disp('ENTERING 380 from 390 6')
%pause
tag_390 = 0; %Ensures that I break out of 390routine after exiting 380routine
tag_400 = 0;
else
NOSC = NOSC -1;
if NOSC<0
NOSC = 0;
end
FSTORE(JX) = FBEST;
if NF>NFMAX
KFLAG = -2;
%disp('ENTERING KFLAG EXIT from 390 2')
%pause
private_KFLAG_EXIT(KFLAG);
tag_390 = 0;
tag_400 = 0; %Ensures that I make a clean exit from the entire program.
else
tag_400 = 0; %Breaks me out of 400 LOOP
tag_390 = 0; %%Kicks me out of while loop, truly stay in big FOR LOOP
end
end
else
CINDER = ((FPREV-FBEST)*ACK + (FBEST-FOBJ)/ACK)/(DENOM+DENOM);
for J=1:NV
if MASK(J)~=0
else
X(J) = XS(J) + CINDER*DLX(J);
if X(J)>XMAX(J)
X(J) = XMAX(J);
end
if X(J)=FBEST %quadratic section statement
for J=1:NV
if NRETRY>=0
DLX(J) = SALVO(J);
end
X(J) = XS(J);
end
if NTRACE>=1
disp('FOBJ= '),disp(FOBJ),disp(' AFTER '),disp(NGIANT),disp('GIANT STEPS')
end
if NGIANT>0
tag_390 = 0; %break out of 390 loop
NCIRC = 0; %CALL TO 640 ROUTINE!!!
NZIP = 0;
NACK = 0;
grandtag = 1;
fortag = 0;
elseif NRETRY>0
if KL>NAH
%disp('ENTERING 380 from 390 7')
%pause
private_380_ROUTINE(1)
tag_400 = 0;
tag_390 = 0; %breaks me out of 390ROUTINE after exiting from 380ROUTINE
else
tag = 1;
for K=KL:NAH
if tag == 1
NRETRY = NAH - K;
COSIN = RZERO;
for J=1:NV
COSIN = COSIN + ERR(J,NOSC)*ERR(J,K);
end
if (K>=(NOSC-1))||((COSIN>RZERO)&(COSIN>COXOM))
KL = KL+1;
NT = NOSC-K;
if NTRACE>=1
disp('*****GIGANTIC STEP WITH PERIOD '),disp(NT),disp(' BEING ATTEMPTED.')
disp('COXCOM= '),disp(COXCOM)
disp('COSIN= '), disp(COSIN)
end
for J=1:NV
SALVO(J) = DLX(J);
DLX(J) = X(J)-XOSC(J,K);
end
FPREV = FOSC(K);
tag_390 = 1; %stay in 390 loop, accomplished with tag=0 and very next IF statement below
tag = 0;
end
end
end
if tag == 0
tag_400 = 0;
tag_390 = 1; %ARRR! Stay in tha 390 loop, matey
else
%disp('ENTERING 380 from 390 8')
%pause
private_380_ROUTINE(1)
tag_390 = 0; %breaks me out of 390ROUTINE after exiting from 380ROUTINE
tag_400 = 0;
end
end
elseif NRETRY == 0
%disp('ENTERING 380 from 390 9')
%pause
private_380_ROUTINE(1)
tag_390 = 0; %%breaks me out of 390ROUTINE after exiting from 380ROUTINE
tag_400 = 0;
else
NOSC = NOSC -1;
if NOSC<0
NOSC = 0;
end
FSTORE(JX) = FBEST;
if NF>NFMAX
KFLAG = -2;
%disp('ENTERING KFLAG EXIT from 390 3')
%pause
private_KFLAG_EXIT(KFLAG);
tag_400 = 0;
tag_390 = 0;
else
tag_390 = 0; %%Kicks me out of 390 routine, truly stay in big FOR loop
tag_400 = 0;
end
end
else
FBEST = FOBJ;
JOCK = 1;
STEPS = NGIANT;
STEPS = STEPS + CINDER;
if NTRACE>=1
disp('FOBJ= '),disp(FOBJ),disp(' AFTER '),disp(STEPS),disp(' GIANT STEPS.')
disp('X(J)= ')
for J=1:NV
disp(X(J))
end
end
tag_390 = 0;
tag_400 = 0;
NCIRC = 0; %Breaks me out of loop
NZIP = 0; %CALL TO 640 ROUTINE
NACK = 0;
grandtag = 1;
fortag = 0;
end
end %Ends quadrature section
end
else
FPREV = FBEST;
FBEST = FOBJ;
for J=1:NV
DLX(J) = DLX(J)*ACK;
end
NGIANT = NGIANT+1;
if NTRACE<1
tag_400 = 1; %Stay in 400 LOOP
elseif NGIANT>1
disp('FOBJ= '),disp(FOBJ),disp(' NF= '),disp(NF)
disp('X(J)= ')
for J=1:NV
disp(X(J))
end
tag_400 = 1; %Stay in 400 LOOP
else
disp('No of steps = ')
for J=1:JX
disp(VEC(J))
end
disp('FOBJ= '_),disp(FPREV),disp(' NF= '), disp(NSAVE)
disp('X(J) = ')
for J=1:NV
disp(X(J))
end
tag_400 = 1; %Stay in 400 LOOP
end
end
end
end
%disp('EXITING 390 ')
%pause
|