?? plus.m
字號:
function quiz2 = plus(a,b)% SDMPB/PLUS - add a constant term to all inequality constraints of an LM problem%% quiz2=plus(quiz1,s) performs quiz2=quiz1+s%% where <quiz1> and <quiz2> are SDMPB objects (LMC problems)% and <s> is a scalar% The operation adds a constant term % to all inequality constraints of the LMC problem.% This constant term is <s> times the identity matrix.% L(u)>=0 becomes L(u)+s*I>=0 %% SEE ALSO sdmpb/minus % This file is part of SeDuMi Interface 1.04 (JUL2002)% Last update : 6th September 2002% Copyright (C) 2002 Dimitri Peaucelle & Krysten Taitz% LAAS-CNRS, Toulouse, France% % This program is free software; you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation; either version 2 of the License, or% (at your option) any later version.% % This program is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% GNU General Public License for more details.% % You should have received a copy of the GNU General Public License% along with this program; if not, write to the Free Software% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %%% check inputs if nargin~=2 error('needs two input arguments'); elseif isa(a,'sdmpb') quiz1=a; s=b; elseif isa(b,'sdmpb') quiz1=b; s=a; end; if ~isnumeric(s) error('can only add a scalar to an SDMPB object'); elseif max([1,1]~=size(s)) error('can only add a scalar to an SDMPB object'); elseif ~isreal(s) error('can only add a real valued scalar to an SDMPB object'); end; %%% clear the previous solution if necessary and add the constant term quiz2=quiz1; if s % clear and change only if s is not zero quiz2 = sdmclear(quiz2); for ii=1:quiz2.ineq.nb quiz2.ineq.meig{ii}=-Inf; lmim=quiz2.ineq.m(ii); lmiM=quiz2.ineq.M(ii); dim=sqrt(lmiM-lmim+1); quiz2.ineq.c(lmim:lmiM,:)=quiz2.ineq.c(lmim:lmiM,:)+s*sdmvec(speye(dim)); end; end;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -