mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-18 03:46:03 +00:00
319 lines
12 KiB
Plaintext
319 lines
12 KiB
Plaintext
|
--- checkpars.m 2008-10-06 10:28:27.000000000 +0900
|
||
|
+++ checkpars.m 2008-10-06 10:28:59.000000000 +0900
|
||
|
@@ -41,7 +41,7 @@
|
||
|
% --------------------------------------------------
|
||
|
% Algorithm selection parameters
|
||
|
% --------------------------------------------------
|
||
|
-if ~isfield(pars,'alg') | sum([0 1 2] == pars.alg) == 0
|
||
|
+if ~isfield(pars,'alg') || sum([0 1 2] == pars.alg) == 0
|
||
|
pars.alg = 2;
|
||
|
end
|
||
|
if ~isfield(pars,'beta') % 0.1 <= beta <= 0.9 (theoretically in (0,1))
|
||
|
@@ -88,7 +88,7 @@
|
||
|
% --------------------------------------------------
|
||
|
% Initialization
|
||
|
% --------------------------------------------------
|
||
|
-if ~isfield(pars,'mu') | pars.mu <= 0
|
||
|
+if ~isfield(pars,'mu') || pars.mu <= 0
|
||
|
pars.mu = 1;
|
||
|
end
|
||
|
% --------------------------------------------------
|
||
|
|
||
|
--- getsymbada.m 2008-10-06 10:28:27.000000000 +0900
|
||
|
+++ getsymbada.m 2008-10-06 10:34:06.000000000 +0900
|
||
|
@@ -42,7 +42,7 @@
|
||
|
|
||
|
Alpq = spones(extractA(At,Ablkjc,0,3,1,psdblkstart(1)));
|
||
|
Ablks = findblks(At,Ablkjc,3,[],psdblkstart);
|
||
|
-if spars(Ablks)==1 | spars(Alpq)==1 | (~isempty(DAt.q) & spars(DAt.q)==1)
|
||
|
+if spars(Ablks)==1 || spars(Alpq)==1 || (~isempty(DAt.q) && spars(DAt.q)==1)
|
||
|
SYMBADA=sparse(ones(size(At,2),size(At,2)));
|
||
|
else
|
||
|
SYMBADA = Alpq' * Alpq + Ablks'*Ablks + DAt.q'*DAt.q;
|
||
|
|
||
|
--- optstep.m 2008-10-06 10:28:27.000000000 +0900
|
||
|
+++ optstep.m 2008-10-06 10:30:28.000000000 +0900
|
||
|
@@ -48,7 +48,7 @@
|
||
|
z0 = x0 / d.l(1);
|
||
|
%This value is never used.
|
||
|
%deptol = 1E-10 * max(x0,z0);
|
||
|
- if (feasratio < -0.5) & (x0 < z0*z0)
|
||
|
+ if (feasratio < -0.5) && (x0 < z0*z0)
|
||
|
x0 = 0; % Try project onto direction.
|
||
|
end
|
||
|
% ------------------------------------------------------------
|
||
|
@@ -82,7 +82,7 @@
|
||
|
% ----------------------------------------
|
||
|
% CHECK WHETHER x[B] >= 0 AND WHETHER RESIDUAL DID NOT DETERIORATE.
|
||
|
% ----------------------------------------
|
||
|
- if (min(x) < 0.0) | ...
|
||
|
+ if (min(x) < 0.0) || ...
|
||
|
(norm(err.b,inf) > 5 * max(max(y0,1e-10 * x0) * R.maxb, y0 * R.maxRb))
|
||
|
x = []; % Incorrect guess of LP-basis
|
||
|
return
|
||
|
@@ -111,7 +111,7 @@
|
||
|
cx = c'*x;
|
||
|
by = b'*y;
|
||
|
z0 = by - cx; %[JFS 9/2003: changed condition below
|
||
|
- if (~isempty(lpNB) & (min(z(lpNB)) < 0.0)) | ...
|
||
|
+ if (~isempty(lpNB) && (min(z(lpNB)) < 0.0)) || ...
|
||
|
normzB > 5 * max(1E-10 * (x0+(x0==0)) * norm(c), min(y0,1e-8) * norm(R.c))
|
||
|
x = []; % Incorrect guess of LP-basis
|
||
|
return
|
||
|
|
||
|
--- posttransfo.m 2008-10-06 10:28:27.000000000 +0900
|
||
|
+++ posttransfo.m 2008-10-06 10:34:23.000000000 +0900
|
||
|
@@ -82,7 +82,7 @@
|
||
|
% ----------------------------------------
|
||
|
% Postprocess the SDP part
|
||
|
% ----------------------------------------
|
||
|
-if pars.sdp==1 & isfield(prep,'sdp')
|
||
|
+if pars.sdp==1 && isfield(prep,'sdp')
|
||
|
xpf(1:K.f,1)=xp(1:K.f);
|
||
|
xp=xp(K.f+1:end);
|
||
|
Kf=K.f;
|
||
|
|
||
|
--- pretransfo.m 2008-10-06 10:28:27.000000000 +0900
|
||
|
+++ pretransfo.m 2008-10-06 10:37:11.000000000 +0900
|
||
|
@@ -43,14 +43,14 @@
|
||
|
K.f = 0;
|
||
|
elseif isempty(K.f)
|
||
|
K.f = 0;
|
||
|
-elseif (K.f~= floor(K.f)) | (K.f < 0)
|
||
|
+elseif (K.f~= floor(K.f)) || (K.f < 0)
|
||
|
error('K.f should be nonnegative integer')
|
||
|
end
|
||
|
if ~isfield(K,'l') % K.l
|
||
|
K.l = 0;
|
||
|
elseif isempty(K.l)
|
||
|
K.l = 0;
|
||
|
-elseif (K.l~= floor(K.l)) | (K.l < 0)
|
||
|
+elseif (K.l~= floor(K.l)) || (K.l < 0)
|
||
|
error('K.l should be nonnegative integer')
|
||
|
end
|
||
|
if ~isfield(K,'q') % K.q
|
||
|
@@ -58,7 +58,7 @@
|
||
|
elseif sum(K.q) == 0
|
||
|
K.q = [];
|
||
|
elseif ~isempty(K.q)
|
||
|
- if (min(K.q) < 2) | any(K.q~= floor(K.q))
|
||
|
+ if (min(K.q) < 2) || any(K.q~= floor(K.q))
|
||
|
error('K.q should contain only integers bigger than 1')
|
||
|
end
|
||
|
if size(K.q,1) > 1
|
||
|
@@ -70,7 +70,7 @@
|
||
|
elseif sum(K.r) == 0
|
||
|
K.r = [];
|
||
|
elseif ~isempty(K.r)
|
||
|
- if (min(K.r) < 3) | any(K.r~= floor(K.r))
|
||
|
+ if (min(K.r) < 3) || any(K.r~= floor(K.r))
|
||
|
error('K.r should contain only integers bigger than 2')
|
||
|
end
|
||
|
if size(K.r,1) > 1
|
||
|
@@ -82,7 +82,7 @@
|
||
|
elseif sum(K.s) == 0
|
||
|
K.s = [];
|
||
|
elseif ~isempty(K.s)
|
||
|
- if min(K.s < 1) | any(K.s~= floor(K.s))
|
||
|
+ if min(K.s < 1) || any(K.s~= floor(K.s))
|
||
|
error('K.s should contain only positive integers')
|
||
|
end
|
||
|
if size(K.s,1) > 1
|
||
|
@@ -95,7 +95,7 @@
|
||
|
if ~isfield(K,'ycomplex') % K.ycomplex
|
||
|
K.ycomplex = [];
|
||
|
elseif ~isempty(K.ycomplex)
|
||
|
- if (min(K.ycomplex) < 1) | (min(size(K.ycomplex)) > 1) | ...
|
||
|
+ if (min(K.ycomplex) < 1) || (min(size(K.ycomplex)) > 1) || ...
|
||
|
any(K.ycomplex~= floor(K.ycomplex))
|
||
|
error('K.ycomplex should be a list containing only positive integers')
|
||
|
end
|
||
|
@@ -109,7 +109,7 @@
|
||
|
if ~isfield(K,'xcomplex') % K.xcomplex
|
||
|
K.xcomplex = [];
|
||
|
elseif ~isempty(K.xcomplex)
|
||
|
- if (min(K.xcomplex) < 1) | (min(size(K.xcomplex))) > 1 | ...
|
||
|
+ if (min(K.xcomplex) < 1) || (min(size(K.xcomplex))) > 1 || ...
|
||
|
any(K.xcomplex~= floor(K.xcomplex))
|
||
|
error('K.xcomplex should be a list containing only positive integers')
|
||
|
end
|
||
|
@@ -123,7 +123,7 @@
|
||
|
if ~isfield(K,'scomplex') % K.scomplex
|
||
|
K.scomplex = [];
|
||
|
elseif ~isempty(K.scomplex)
|
||
|
- if min(K.scomplex) < 1 | min(size(K.scomplex)) > 1 | ...
|
||
|
+ if min(K.scomplex) < 1 || min(size(K.scomplex)) > 1 || ...
|
||
|
any(K.scomplex~= floor(K.scomplex))
|
||
|
error('K.scomplex should be a list containing only positive integers')
|
||
|
end
|
||
|
@@ -138,7 +138,7 @@
|
||
|
% Check size of At,b,c (w.r.t. K)
|
||
|
% Let m = #eq-constraints, N = #variables (before transformations)
|
||
|
% ----------------------------------------
|
||
|
-if (min(size(b)) > 1) | (min(size(c)) > 1)
|
||
|
+if (min(size(b)) > 1) || (min(size(c)) > 1)
|
||
|
error('Parameters b and c must be vectors')
|
||
|
end
|
||
|
m = min(size(At));
|
||
|
@@ -175,16 +175,16 @@
|
||
|
% ------------------------------------------------------------
|
||
|
% Check for NaN and Inf
|
||
|
% ------------------------------------------------------------
|
||
|
-if any(any(isnan(At))) | any(isnan(b)) | any(isnan(c))
|
||
|
+if any(any(isnan(At))) || any(isnan(b)) || any(isnan(c))
|
||
|
error('A,b,c data contains NaN values')
|
||
|
end
|
||
|
-if any(any(isinf(At))) | any(isinf(b)) | any(isinf(c))
|
||
|
+if any(any(isinf(At))) || any(isinf(b)) || any(isinf(c))
|
||
|
error('A,b,c data contains Inf values')
|
||
|
end
|
||
|
% ------------------------------------------------------------
|
||
|
% Save the standardized data for further use if needed
|
||
|
% ------------------------------------------------------------
|
||
|
-if isfield(pars,'errors') & pars.errors==1
|
||
|
+if isfield(pars,'errors') && pars.errors==1
|
||
|
origcoeff.At=At;
|
||
|
origcoeff.c=c;
|
||
|
origcoeff.b=b;
|
||
|
@@ -271,7 +271,7 @@
|
||
|
if ~isfield(pars,'free')
|
||
|
pars.free=1;
|
||
|
end
|
||
|
-if pars.free & K.l>0
|
||
|
+if pars.free && K.l>0
|
||
|
stest=c(K.f+1:K.f+K.l)-At(K.f+1:K.f+K.l,:)*rand(m,1);
|
||
|
%Now we detect if stest contains the same vector twice, or opposite
|
||
|
%vectors.
|
||
|
|
||
|
--- sedumi.m 2008-10-06 10:28:27.000000000 +0900
|
||
|
+++ sedumi.m 2008-10-06 10:35:24.000000000 +0900
|
||
|
@@ -293,10 +293,10 @@
|
||
|
my_fprintf(pars.fid,'Detected %i diagonal SDP block(s) with %i linear variables\n',blockcount,varcount);
|
||
|
end
|
||
|
end
|
||
|
- if isfield(prep,'freeblock1') & length(prep.freeblock1)>0
|
||
|
+ if isfield(prep,'freeblock1') && length(prep.freeblock1)>0
|
||
|
my_fprintf(pars.fid,'Detected %i free variables in the linear part\n',length(prep.freeblock1));
|
||
|
end
|
||
|
- if isfield(prep,'Kf') & prep.Kf>0
|
||
|
+ if isfield(prep,'Kf') && prep.Kf>0
|
||
|
switch pars.free
|
||
|
case 0
|
||
|
my_fprintf(pars.fid,'Split %i free variables\n',prep.Kf);
|
||
|
@@ -384,9 +384,9 @@
|
||
|
keyboard
|
||
|
end
|
||
|
|
||
|
- if pars.stepdif==2 & ...
|
||
|
- (iter>20 | (iter>1 & (err.kcg + Lsd.kcg>3)) | ...
|
||
|
- (iter>5 & abs(1-feasratio)<0.05) )
|
||
|
+ if pars.stepdif==2 && ...
|
||
|
+ (iter>20 || (iter>1 && (err.kcg + Lsd.kcg>3)) || ...
|
||
|
+ (iter>5 && abs(1-feasratio)<0.05) )
|
||
|
pars.stepdif=1;
|
||
|
end
|
||
|
% --------------------------------------------------
|
||
|
@@ -438,7 +438,7 @@
|
||
|
meritOld = merit;
|
||
|
merit = (sum(R.w) + max(R.sd,0))^2 * y0 / R.b0;
|
||
|
rate = merit / meritOld;
|
||
|
- if (rate >= 0.9999) & (wr.desc == 1)
|
||
|
+ if (rate >= 0.9999) && (wr.desc == 1)
|
||
|
% ------------------------------------------------------------
|
||
|
% STOP = -1 --> Stop due to numerical problems
|
||
|
% ------------------------------------------------------------
|
||
|
@@ -470,7 +470,7 @@
|
||
|
% If we get in superlinear region of LP,
|
||
|
% try to guess optimal solution:
|
||
|
% ----------------------------------------
|
||
|
- if lponly & (rate < 0.05)
|
||
|
+ if lponly && (rate < 0.05)
|
||
|
[xsol,ysol] = optstep(A,b,c, y0,y,d,v,dxmdz, ...
|
||
|
K,L,symLden,dense, Ablkjc,Aord,ADA,DAt, feasratio, R,pars);
|
||
|
if ~isempty(xsol)
|
||
|
@@ -478,7 +478,7 @@
|
||
|
feasratio = 1 - 2*(xsol(1)==0);
|
||
|
break
|
||
|
end
|
||
|
- elseif (by > 0) & (abs(1+feasratio) < 0.05) & (R.b0*y0 < 0.5)
|
||
|
+ elseif (by > 0) && (abs(1+feasratio) < 0.05) && (R.b0*y0 < 0.5)
|
||
|
if max(eigK(full(qreshape(Amul(A,dense,y,1),1,K)),K)) <= pars.eps * by
|
||
|
STOP = 3; % Means Farkas solution found !
|
||
|
break
|
||
|
@@ -576,7 +576,7 @@
|
||
|
% If the quality of the Farkas solution is good and better than
|
||
|
% the approx. feasible soln, set x0=0: Farkas solution found.
|
||
|
% ------------------------------------------------------------
|
||
|
- if (reldirinf < pars.eps) | (relinf > max(pars.bigeps, reldirinf))
|
||
|
+ if (reldirinf < pars.eps) || (relinf > max(pars.bigeps, reldirinf))
|
||
|
x0 = 0.0;
|
||
|
pinf = pdirinf;
|
||
|
dinf = ddirinf;
|
||
|
@@ -654,7 +654,7 @@
|
||
|
my_fprintf(pars.fid, 'Failed: no sensible solution/direction found.\n');
|
||
|
info.numerr = 2;
|
||
|
elseif STOP == -1
|
||
|
- if (pinf > -pars.eps * cx) & (dinf > pars.eps * by)
|
||
|
+ if (pinf > -pars.eps * cx) && (dinf > pars.eps * by)
|
||
|
info.numerr = 1;
|
||
|
else
|
||
|
info.numerr = 0;
|
||
|
|
||
|
--- stepdif.m 2008-10-06 10:28:27.000000000 +0900
|
||
|
+++ stepdif.m 2008-10-06 10:35:37.000000000 +0900
|
||
|
@@ -61,7 +61,7 @@
|
||
|
% CASE Rsd > 0: gap constraint locally part of merit.
|
||
|
% CASE Rsd < 0: gap constraint locally not part of merit.
|
||
|
% ------------------------------------------------------------
|
||
|
-usegap = (R.sd > 0) | (R.sd == 0 & dRg > 0);
|
||
|
+usegap = (R.sd > 0) || (R.sd == 0 && dRg > 0);
|
||
|
if usegap
|
||
|
r0 = R.w(1)+R.w(2)+R.sd;
|
||
|
beta = (rdy0 * R.w(1) + rcdx)/ r0;
|
||
|
diff -u widelen.m widelen.m
|
||
|
--- widelen.m 2008-10-06 10:28:27.000000000 +0900
|
||
|
+++ widelen.m 2008-10-06 10:32:16.000000000 +0900
|
||
|
@@ -71,7 +71,7 @@
|
||
|
% ------------------------------------------------------------
|
||
|
t = 0.0;
|
||
|
ntry = 0; % do loop at least once
|
||
|
-while (t < 0.5 * tR) | ( (fullt-tR) + (1e-7 * fullt) < (tR - t) ) | ntry==0
|
||
|
+while (t < 0.5 * tR) || ( (fullt-tR) + (1e-7 * fullt) < (tR - t) ) || ntry==0
|
||
|
ntry = 1;
|
||
|
if tR == maxt % Bisection
|
||
|
tM = 0.1 * t + 0.9 * tR;
|
||
|
@@ -105,7 +105,7 @@
|
||
|
% ALL:
|
||
|
wM.lab = [xM(1:K.l).*zM(1:K.l); detxz ./ lab2q; lab2q; psdeig(wM.s,K)];
|
||
|
[deltaM,hM,alphaM] = iswnbr(wM.lab, thetaSQR);
|
||
|
- if (deltaM <= pars.beta) | ((tM < fullt / 10) & (deltaM < 1))
|
||
|
+ if (deltaM <= pars.beta) || ((tM < fullt / 10) && (deltaM < 1))
|
||
|
w = wM;
|
||
|
t = tM;
|
||
|
wr.h=hM;
|
||
|
|
||
|
--- wregion.m 2008-10-06 10:45:27.000000000 +0900
|
||
|
+++ wregion.m 2008-10-06 10:45:48.000000000 +0900
|
||
|
@@ -62,9 +62,9 @@
|
||
|
[uzc.u,zispos] = psdfactor(zc,K);
|
||
|
critval = max(y0, sqrt(min(d.l(1),1/d.l(1)))*v(1)); % >= y0
|
||
|
critval = max(1E-3, pars.cg.restol) * critval * R.maxRb;
|
||
|
- if (~xispos) | (~zispos) | (errc.maxb > critval) ...
|
||
|
- | ( (~isempty(uxc.tdet)) & (min(uxc.tdet) <= 0.0)) ...
|
||
|
- | ( (~isempty(uzc.tdet)) & (min(uzc.tdet) <= 0.0))
|
||
|
+ if (~xispos) || (~zispos) || (errc.maxb > critval) ...
|
||
|
+ || ( (~isempty(uxc.tdet)) && (min(uxc.tdet) <= 0.0)) ...
|
||
|
+ || ( (~isempty(uzc.tdet)) && (min(uzc.tdet) <= 0.0))
|
||
|
STOP = -1; % Reject and terminate
|
||
|
dxmdz = [];
|
||
|
err = errc;
|
||
|
@@ -121,7 +121,7 @@
|
||
|
% i.e. errb <= phi*(-dy0) * (1+t*dy0/y0) * maxRb
|
||
|
% ----------------------------------------
|
||
|
PHI = 0.5;
|
||
|
- if dy0 < 0 & (PHI*dy0^2*R.maxRb)~=0
|
||
|
+ if dy0 < 0 && (PHI*dy0^2*R.maxRb)~=0
|
||
|
critval = - (PHI * dy0*R.maxRb + err.maxb)*y0c / (PHI*dy0^2*R.maxRb);
|
||
|
else
|
||
|
critval = 1;
|