https://github.com/epnev/ca_source_extraction
Tip revision: 49b7884e93348d50df7173e1619d7499468bb1f6 authored by epnev on 22 August 2019, 14:24:41 UTC
fix bug introduced with 9e524e29f17d35db3c79a87de32209c7dccda186
fix bug introduced with 9e524e29f17d35db3c79a87de32209c7dccda186
Tip revision: 49b7884
update_order_greedy.m
function [O,lo] = update_order_greedy(A)
% greedy method for updating order
K = size(A,2);
if ~(size(A,1) == K)
A = A'*A;
end
A = A>0;
A(1:K+1:K^2) = 0;
O{1} = 1;
lo(1) = 1;
for i = 2:K
cont = true;
for j = 1:length(O)
if ~any(A(i,O{j}))
O{j} = [O{j},i];
lo(j) = lo(j) + 1;
cont = false;
break;
end
end
if cont
O{length(O)+1} = j;
lo = [lo,1];
end
end
end