function varargout=rank(varargin)
%RANK (overloaded)
% Author Johan L鰂berg
% $Id: rank.m,v 1.5 2005/07/18 15:01:30 joloef Exp $
% ***************************************************
% This file defines a nonlinear operator for YALMIP
%
% It can take three different inputs
% For double inputs, it returns standard double values
% For sdpvar inputs, it generates a an internal variable
% When first input is 'model' it generates the epigraph
%
% % ***************************************************
switch class(varargin{1})
case 'double' % What is the numerical value of this argument (needed for displays etc)
% SHOULD NEVER HAPPEN, THIS SHOULD BE CAUGHT BY BUILT-IN
error('Overloaded SDPVAR/RANK CALLED WITH DOUBLE. Report error')
case 'sdpvar' % Overloaded operator for SDPVAR objects. Pass on args and save them.
varargout{1} = yalmip('addextendedvariable',mfilename,varargin{1});
case 'char' % YALMIP send 'model' when it wants the epigraph or hypograph
if isequal(varargin{1},'graph')
varargout{1} = set([]);
varargout{2} = 0; % Neither convex or concave
else
error('SDPVAR/RANK called with CHAR argument?');
end
otherwise
error('Strange type on first argument in SDPVAR/RANK');
end