Orthogonal Matching Pursuit algorithm implementation problem

1 view (last 30 days)
I am trying to implement orthogonal Matching Pursuit algorithm. The algorithm can be found here.
It says that the residual is orthogonal to the span of selected atoms but I am getting only the first selected atom as orthogonal to the residual. No later selected atoms are coming out to be orthogonal to the residual.
Kindly check the code and explain where Am I doing it wrong?
clc,clear;
dictionary = [1 0; 1/2 sqrt(3)/2; -1/sqrt(2) -1/sqrt(2)]';
t=5;
s=[1;1/2];
r=s;
atoms=zeros(size(dictionary,1),size(dictionary,2));
coefs=zeros(size(dictionary,2),1);
%Normalize the dictionary
for index=1:size(dictionary,2)
dictionary(:,index)=dictionary(:,index)./norm(dictionary(:,index));
end
D=dictionary;
index=[];
while(t>1e-15 && sum(dictionary(:)~=0))%Process while (Eucledian norm > 10^-15)
inner_product=dictionary'*r; %Dot Product
[m,ind]=max(abs(inner_product));
index=[index ind];
atoms(:,ind)=dictionary(:,ind); %Select atom which has maximum inner product
x=(atoms(:,ind)'*atoms(:,ind))\(atoms(:,ind)'*r); %Least Square method
coefs(ind)=x;
r=r-atoms(:,ind)*x;
t=power(norm(r),2);
end
More Links: Contains Screen shots of the same algorithm from different papers:

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!