A Convex Optimization Algorithm For Sparse Representation And Applications In Classification Problems