function [ DS0, Di0, beta0, c0, Q0 ] = OMPFinalRefi( f, D, tol, No, ind )
% OMPFinalRefi Refinment of OMP
%
% It creates an atomic decomposition for approximation a signal using OMP method up to a
% given tolerance. When possible, the sparsity is improved afterwards by a combination of
% swapping and backward deleting steps.
%
% You can choose a tolerance, the maximum number of atoms in the decomposition and an
% initial subspace to influence the OOMP algorithm. Non-selected atoms subtracted by their
% component in the chosen space are also available.
%
% Usage: [ D0, Di0 ] = OMPFinalRefi( f, D, tol );
% [ DS0, Di0, beta0, c0, Q0 ] = OMPFinalRefi( f, D, tol, No, ind);
%
% Inputs:
% f analyzing signal
% D dictionary of normalized atoms
% tol desired distance between f and its approximation the routine will stop if
% norm(f'-Dsub*(f*beta)')*sqrt(delta)