Code of sparse coding algorithm. Reference: http://ufldl.stanford.edu/wiki/index.php/Exercise:Sparse_Coding