sparsecoding implemented in python