update for sparse coding