


Penalty function for augmented Lagrangian function.
function [ret] = phi2(t) ... penalty function
input can be double scalar/vector/... whatever,
return values are of the same type
uses parameter R from option settings

0001 function [ret] = phi2(obj,t) 0002 % Penalty function for augmented Lagrangian function. 0003 % function [ret] = phi2(t) ... penalty function 0004 % input can be double scalar/vector/... whatever, 0005 % return values are of the same type 0006 % uses parameter R from option settings 0007 % 0008 0009 % log() is natural logarithm in C as well as in Matlab 0010 % added possibility to treat t even if the input is a vector 0011 0012 R=obj.allopts.phi_R; 0013 0014 ret=t; % otherwise the result would be a column vector 0015 if (R < 0) 0016 ind = t < R; 0017 ret(ind) = -(1+R)^2*log((1+2*R-t(ind)) / (1+R)) + R + .5*R*R; 0018 ret(~ind) = t(~ind) + .5*t(~ind).^2; 0019 else 0020 ind = t < R; 0021 ret(ind) = -log(1-t(ind)); 0022 ret(~ind) = ((1 - 2*R)*t(~ind) + .5*t(~ind).^2 - .5*(2*R - 3*R*R)) / (1 - R) / (1 - R) - log(1 - R); 0023 end 0024 0025 return; 0026 0027