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

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

Added original make3d

File size: 970 bytes
Line 
1function Y=clean(Y)
2%clean (overloaded)
3
4% Author Johan Löfberg
5% $Id: clean.m,v 1.1 2006/07/13 19:40:59 joloef Exp $
6
7i = length(Y.dim);
8while i>2
9    if Y.dim(end) == 1
10        Y.dim(end) = [];
11        i = i - 1;
12    else
13        break
14    end
15end
16if length(Y.dim) == 2;
17    Y = reshape(sdpvar(Y),Y.dim(1),Y.dim(2));
18    Y = clean(Y);
19else
20    temp = any(Y.basis,1);
21    temp = temp(2:end);
22    index = find(temp);
23    if ~isempty(index)
24        Z = Y;
25        if length(index)~=length(Y.lmi_variables)
26            Y.basis = Y.basis(:,[1 1+index]);
27            Y.lmi_variables = Y.lmi_variables(index);
28        end
29        if ~isreal(Y.basis) & nargin==2
30            basis_real = real(Y.basis);
31            basis_imag = imag(Y.basis);
32            basis_real(abs(basis_real)<tol) = 0;
33            basis_imag(abs(basis_imag)<tol) = 0;
34            Y.basis = basis_real + sqrt(-1)*basis_imag;
35        end
36    else
37        Y = full(reshape(Y.basis(:,1),Y.dim));
38    end
39end
Note: See TracBrowser for help on using the repository browser.