Use sparse matrices when appropriate