Code covered by the BSD License  

Highlights from
Greedy Algorithms promoting Group Sparsity V3

from Greedy Algorithms promoting Group Sparsity V3 by Angshul Majumdar
Approximate Greedy Solutions to the problem min||x(k)||_2,0 such that Ax = b

BMP(A, y, group, err)
function [s, residual] = BMP(A, y, group, err)

% Block Matching Pursuit

% Input
% A = N X d dimensional measurment matrix
% y = N dimensional observation vector
% group = labels
% m = sparsity of the underlying signal

% Output
% s = estimated sparse signal
% r = residual 

% Copyright (c) Angshul Majumdar 2009

if nargin < 5
     err = 1e-5;
end

c = max(group);
s = zeros(size(A,2),1);
r(:,1) = y; L = []; Psi = [];
i = 2;
for j = 1:c
    g{j} = find(group == j);
end
while (i < c) && (norm(r(:,end))>err)
    l = A'*r(:,i-1);
    [B, IX] = sort(abs(l), 'descend');
    j = 1;
    while isempty(find(g{j}==IX(1))) %#ok<EFIND>
        j = j+1;
    end
    s(g{j}) = s(g{j}) + l(g{j});
    mask = zeros(size(A,2),1);
    mask(g{j}) = l(g{j});
    r(:,i) = r(:,i-1) - A*mask;
    i = i+1;
end
residual = r(:,end);

Contact us at files@mathworks.com