add support of sparse matrix