Add diffusion_matrix_sparse() and its tests.