renamed 'index()' to 'idx()' to avoid collision with a nonstandard built-in function in Apple OpenCL