make the W to be sparse matrix