source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/extras/@ncvar/eig.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 1.7 KB
Line 
1function varargout=eig(varargin)
2%ABS (overloaded)
3%
4% y = eig(x)
5%
6% The variable y represents the sorted eigenvalues of x.
7%
8% EIG is implemented using a nonlinear operator framework,
9% but can currently not be used in any optmization model.
10
11% Author Johan Löfberg
12% $Id: eig.m,v 1.1 2006/08/10 18:00:20 joloef Exp $
13
14
15
16% ***************************************************
17% This file defines a nonlinear operator for YALMIP
18%
19% It can take three different inputs
20% For double inputs, it returns standard double values
21% For sdpvar inputs, it genreates a an internal variable
22% When first input is 'model' it generates the epigraph
23%
24% % ***************************************************
25switch class(varargin{1})
26
27    case 'double' % What is the numerical value of this argument (needed for displays etc)
28        % SHOULD NEVER HAPPEN, THIS SHOULD BE CAUGHT BY BUILT-IN
29        error('Overloaded SDPVAR/EIG CALLED WITH DOUBLE. Report error')
30
31    case 'sdpvar' % Overloaded operator for SDPVAR objects. Pass on args and save them.
32        X = varargin{1};
33        if size(X,1)~=size(X,2)
34            error('Matrix must be square.')
35        end
36        y=[];
37        for i = 1:length(X)
38            y=[y;yalmip('addextendedvariable','yeig',X,i)]; %ith eigenvalue
39        end
40        varargout{1}=y;           
41
42    case 'char' % YALMIP send 'graph' when it wants the epigraph or hypograph
43        error('eig operator not supported');
44        if isequal(varargin{1},'graph')
45            t = varargin{2};
46            X = varargin{3};
47            varargout{1} = set(-t < X < t);
48            varargout{2} = 1; % Convex operator
49            error('SDPVAR/ABS called with CHAR argument?');
50        end
51    otherwise
52        error('Strange type on first argument in SDPVAR/ABS');
53end
Note: See TracBrowser for help on using the repository browser.