source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/modules/sos/corrsparsity.m @ 37

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

Added original make3d

File size: 1.2 KB
Line 
1function [C,D] = corrsparsity(exponent_p_monoms,options);
2
3if options.sos.csp
4    n = size(exponent_p_monoms,2);
5    C = zeros(n,n);
6    for i = 1:size(exponent_p_monoms,1)
7        [col,row] = find(exponent_p_monoms(i,:));
8        for j = 1:length(row)
9            C(row(j),row(j)) = 1;
10            for k = 2:length(row)
11                C(row(j),row(k)) = 1;
12                C(row(k),row(j)) = 1;
13            end
14        end
15    end
16
17    R = chol(C+100*eye(n));
18    for i = 1:size(R,1)
19        [row,col] = find(R(i,:));
20        if i>1
21            is_in = 0;
22            for j = 1:length(D)
23                if all(ismember(col,D{j}))
24                    is_in = 1;
25                end
26            end
27            if ~is_in
28                D{end+1} = col;
29            end
30        else
31            D{1} = col;
32        end
33    end
34    if length(D)>1 &  options.verbose>0
35        the_text = 'Detecting correlative sparsity..';
36
37        [uu,ii,oo] = unique(cellfun('prodofsize',D));
38        for i = 1:length(uu)
39            n_this = length(find(oo==i));
40
41            the_text = [the_text num2str(uu(i)) '(' num2str(n_this) ')' ' '];
42        end       
43        disp(the_text);
44    end
45else
46    C = ones(size(exponent_p_monoms,2));
47    D{1} = 1:size(exponent_p_monoms,2);
48end
Note: See TracBrowser for help on using the repository browser.