generalize view function to dense arrays