Skip to content

Commit

Permalink
add debug
Browse files Browse the repository at this point in the history
  • Loading branch information
areslp committed Mar 14, 2013
1 parent 62cb4b9 commit 556f788
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 5 deletions.
53 changes: 51 additions & 2 deletions multi_lrr_acc.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
mu=1e-6;
max_mu=10^10;
rho=1.9;
epsilon=1e-4;
% epsilon=1e-4;
% epsilon2=1e-5; % must be small!
epsilon=1e-6;
epsilon2=1e-5; % must be small!

% pre caculate matrix value
Expand Down Expand Up @@ -96,7 +98,7 @@

M=cell(k,1);

MAX_ITER=2000;
MAX_ITER=1000;
iter=0;
convergenced=false;

Expand All @@ -108,6 +110,7 @@
while ~convergenced
if iter>MAX_ITER
fprintf(1,'max iter num reached!\n');
save_matrix(J,S,Z,F);
break;
end
cmu=cell(k,1);
Expand All @@ -131,6 +134,10 @@
Zk{i}=Z{i};
Z{i}=reshape(ZZ(i,:),n,n)';
end

% TODO: for debug
% print_matrix(J,S,Z,F,svp,mu);

% update E_i
Ek=E;
[E]=cellfun(@updateE,X,S,Y,cmu,clambda,'UniformOutput',false);
Expand Down Expand Up @@ -164,6 +171,7 @@
fprintf(1,'svp%d %d,',i,svp{i});
end
fprintf(1,'\n');
save_matrix(J,S,Z,F);
end
% update multipliers
[Y]=cellfun(@updateY,Y,cmu,Xc,'UniformOutput',false);
Expand Down Expand Up @@ -245,3 +253,44 @@
warning(S.identifier, S.message);
result = NaN;

function [] = save_matrix(J,S,Z,F)
k=length(J);
% TODO: for debug
for i=1:k
h=figure('Visible', 'off');
imagesc(S{i});
colormap(gray);
axis equal;
saveas(h,['S' num2str(i) '.png']);
end
for i=1:k
h=figure('Visible', 'off');
imagesc(Z{i});
colormap(gray);
axis equal;
saveas(h,['Z' num2str(i) '.png']);
end
for i=1:k
h=figure('Visible', 'off');
imagesc(J{i});
colormap(gray);
axis equal;
saveas(h,['J' num2str(i) '.png']);
end
for i=1:k
h=figure('Visible', 'off');
imagesc(F{i});
colormap(gray);
axis equal;
saveas(h,['F' num2str(i) '.png']);
end

function [] = print_matrix(J,S,Z,F,svp,mu)
% TODO: for debug
k=length(J);
for i=1:k
[aa bb1 cc]=svd(Z{i});
[aa bb2 cc]=svd(S{i});
[aa bb3 cc]=svd(F{i});
fprintf(1,'Z%d rank %d,S%d rank %d,F%d rank %d,J%d rank is %d\n',i,length(find(diag(bb1)>1/mu)),i,length(find(diag(bb2)>1/mu)),i,length(find(diag(bb3)>1/mu)),i,svp{i});
end
6 changes: 3 additions & 3 deletions toolbox_graph/plot_mesh.m
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@
h = patch('vertices',vertex,'faces',face,'FaceVertexCData',face_vertex_color, 'FaceColor',shading_type);
end
colormap gray(256);
lighting phong;
camlight infinite;
camproj('perspective');
% lighting phong;
% camlight infinite;
% camproj('perspective');
axis square;
axis off;

Expand Down

0 comments on commit 556f788

Please sign in to comment.