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

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

Added original make3d

File size: 2.0 KB
Line 
1function [F,properties,arguments,fcn]=model(X,method,options,extstruct)
2%MODEL  Extracts nonlinear operator models
3%
4% [F,properties] = model(x)
5%
6% MODEL returns the constraints needed to model a variable related to an
7% extended operator such as min, max, abs, norm, geomean, ...
8%
9% Examples :
10%
11% sdpvar x y;
12% t = min(x,y);
13% [F,properties] = epigraph(t)
14% Gives (F = set(t<x) + set(t<y))
15%
16% sdpvar x y
17% t = max(norm([x;y],1+y))
18% [F,properties] = epigraph(t)
19% Gives (F = set(u<t) + set(1+y<t))
20% where u is the variable modelling norm([x;y])
21
22% Author Johan Löfberg
23% $Id: model.m,v 1.1 2006/08/10 18:00:21 joloef Exp $
24
25extvar = getvariables(X);
26arguments   = cell(1,length(extvar));
27properties  = cell(1,length(extvar));
28
29if nargin<2
30    method = 'graph';
31end
32
33if nargin < 3
34    options = [];
35end
36
37if nargin<4
38    extstruct = yalmip('extstruct',extvar);
39elseif isempty(extstruct)
40    extstruct = yalmip('extstruct',extvar);
41end
42
43if isempty(extstruct)
44    error('This is not a nonlinear operator variable');
45end
46
47fcn = extstruct.fcn;
48switch fcn
49    % *********************************************************************
50    % mpower, max, min  are currently implmeneted in a non-standard way for
51    % both performance and technical reasons
52    % *********************************************************************
53    case 'mpower'
54        [F,properties,arguments] = mpower_internal(X,method,options,extstruct);
55
56    case 'max'
57        [F,properties,arguments] = max_internal(X,method,options,extstruct);
58
59    case 'min'
60        [F,properties,arguments] = min_internal(X,method,options,extstruct);
61
62    otherwise
63        try
64            [F,properties,arguments] = feval(extstruct.fcn,method,extstruct.var,extstruct.arg{:});
65        catch
66            error(['Failed when trying to create a model for the "' extstruct.fcn '" operator']);
67        end
68end
69% This field is not official, and currently only used in sort
70if ~isfield(properties,'models')
71    properties.models = getvariables(extstruct.var);
72end
73
74
Note: See TracBrowser for help on using the repository browser.