Dictionary learning for sparse representations is generally conducted in two alternating steps-sparse coding and dictionary updating. In this paper, a new approach to solve the sparse coding step is proposed. Because this step involves an ℓ0 -norm, most, if not all, existing solutions only provide a local or approximate solution. Instead, a real ℓ0 optimization is considered for the sparse coding problem providing a global solution.