Nice way to iterate through a triangular matrix