A Density Functional for Sparse Matter