⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdmlmi.m

📁 这是matlab解2阶锥工具包
💻 M
字号:
function [quiz,lmiindex] = sdmlmi(quiz,dim,name)% SDMPB/SDMLMI - declare a new inequality constraint%% [quiz,lmiindex] = sdmlmi(quiz,dim,name);%  %   Adds an inequality constraint (to be specified afterwards)%   <dim> is the size of the matrix inequality %   or the size of each block if <dim> is a vector%   <name> is an optional string that describes the inequality.%% Examples:%%   [quiz,lmiindex] = sdmlmi(quiz,4,'1st example')%   declares a constraint with 4 rows and 4 columns - no block partitioning.%%   [quiz,lmiindex] = sdmlmi(quiz,[5 7],'2nd example')%   declares a block partitioned constraint with four blocks such that:%             | B1    B3 | < 0%             | B2    B4 | %   where B1 is a 5-by-5 matrix%         B4 is a 7-by-7 matrix%% SEE ALSO sdmvar, sdmineq, sdmlme and sdmsol.%   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('not enough input arguments');  elseif nargin>3    error('too many input arguments');  elseif ~isa(quiz,'sdmpb')    error('1st input argument must be a SDMPB object');  elseif nargin<3    name='NO NAME';  end;      %%% check dim input  if min(size(dim))~=1    error('2nd input argument (blocks dimensions) must be a scalar or a vector');  end;  if round(dim)~=dim    error('2nd input argument (blocks dimensions) is not a vector of integer');  elseif any(dim<=0)    error('2nd input argument (blocks dimensions) must be positive');  end;  %%% check input name  if ~ischar(name)    error('3rd input argument (name of the constraint) must be a string');  end;  %%% clear the previous solution if necessary  quiz = sdmclear(quiz);  %%% define the new inequality constraint  dim=sdmvec(dim);  dimension=sum(dim);  nbblock=length(dim);  quiz.ineq.nb=quiz.ineq.nb+1;  lmiindex=quiz.ineq.nb;  if isempty(quiz.ineq.M)    previousM=0;  else    previousM=quiz.ineq.M(lmiindex-1);  end;  quiz.ineq.row=[quiz.ineq.row,dimension];  quiz.ineq.m=[quiz.ineq.m,previousM+1];  quiz.ineq.M=[quiz.ineq.M,previousM+dimension^2];  quiz.ineq.c=[quiz.ineq.c;(sparse(dimension^2,1))];  quiz.ineq.At= [quiz.ineq.At;(sparse(dimension^2,size(quiz.ineq.At,2)))];  quiz.ineq.Atconj= [quiz.ineq.Atconj;(sparse(dimension^2,size(quiz.ineq.Atconj,2)))];  quiz.K.s=[quiz.K.s,dimension];  quiz.ineq.name{lmiindex}=name;  quiz.ineq.meig{lmiindex}=-Inf;    %%% Temporary vector to save the place of the first element of each block   blockm=ones(nbblock,1)+(tril(ones(nbblock,nbblock),-1))*dim;  blockM=tril(ones(nbblock,nbblock))*dim;  quiz.ineq.blockm{lmiindex}=blockm;  quiz.ineq.blockM{lmiindex}=blockM;          

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -