source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/@sdpvar/sdpvarfun.m @ 37

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

Added original make3d

File size: 946 bytes
Line 
1function Y=sdpvarfun(varargin)
2%SDPVARFUN Applies operator on matrix variable
3%
4% Y = sdpvarfun('op',X)  Applies the Matlab operator 'op' on X
5%
6% Example : Y = sdpvarfun('triu',X)  Extracts upper triangluar part
7
8% Author Johan Löfberg
9% $Id: sdpvarfun.m,v 1.4 2006/07/26 20:17:58 joloef Exp $ 
10
11op = varargin{1};
12if ~isa(op,'char')
13  error('First argument must be a string with the function name')
14end
15
16X = varargin{2};
17Y = X;
18
19x_lmi_variables = X.lmi_variables;
20lmi_variables = [];
21
22Y.basis = [];
23opX = feval(op,reshape(X.basis(:,1),X.dim(1),X.dim(2)));
24Y.basis = opX(:);
25
26j = 1;
27for i = 1:length(x_lmi_variables)
28  opX = feval(op,reshape(X.basis(:,i+1),X.dim(1),X.dim(2)));
29  if (norm(opX,inf)>0)
30    Y.basis(:,j+1) = opX(:);
31    lmi_variables = [lmi_variables x_lmi_variables(i)];
32    j = j+1;
33  end
34end 
35Y.dim(1) = size(opX,1);
36Y.dim(2) = size(opX,2);
37Y.lmi_variables = lmi_variables;
38% Reset info about conic terms
39Y.conicinfo = [0 0];
Note: See TracBrowser for help on using the repository browser.