1 | function varargout = sin (varargin) |
---|
2 | %SIN (overloaded) |
---|
3 | |
---|
4 | % Author Johan Löfberg |
---|
5 | % $Id: sin.m,v 1.4 2006/09/08 14:16:58 joloef Exp $ |
---|
6 | |
---|
7 | switch class(varargin{1}) |
---|
8 | |
---|
9 | case 'double' % What is the numerical value of this argument (needed for displays etc) |
---|
10 | % SHOULD NEVER HAPPEN, THIS SHOULD BE CAUGHT BY BUILT-IN |
---|
11 | error('Overloaded SDPVAR/SIN CALLED WITH DOUBLE. Report error') |
---|
12 | |
---|
13 | case 'sdpvar' % Overloaded operator for SDPVAR objects. Pass on args and save them. |
---|
14 | if length(varargin{1}) == 1 |
---|
15 | varargout{1} = yalmip('addEvalVariable',mfilename,varargin{1}); |
---|
16 | else |
---|
17 | y = []; |
---|
18 | for i = 1:length(varargin{1}) |
---|
19 | y = [y;yalmip('addEvalVariable',mfilename,extsubsref(varargin{1},i))]; |
---|
20 | end |
---|
21 | varargout{1} = y; |
---|
22 | end |
---|
23 | |
---|
24 | case 'char' % YALMIP sends 'model' when it wants the epigraph or hypograph |
---|
25 | switch varargin{1} |
---|
26 | case {'graph','milp'} |
---|
27 | t = varargin{2}; |
---|
28 | X = varargin{3}; |
---|
29 | |
---|
30 | % This is different from so called extended operators |
---|
31 | % Just do it! |
---|
32 | F = SetupEvaluationVariable(varargin{:}); |
---|
33 | |
---|
34 | % Let YALMIP know about convexity etc |
---|
35 | varargout{1} = F; |
---|
36 | varargout{2} = struct('convexity','none','monotonicity','none','definiteness','none'); |
---|
37 | varargout{3} = X; |
---|
38 | |
---|
39 | otherwise |
---|
40 | error('SDPVAR/SIN called with CHAR argument?'); |
---|
41 | end |
---|
42 | otherwise |
---|
43 | error('SDPVAR/SIN called with CHAR argument?'); |
---|
44 | end |
---|