not using sparse matrix