'Getting a section of an array in OpenCL

I need to test if an array except for one index contains a specific number. I can't think of a great way to explain this, so I'm just going to write the python equivalent.

ommited_index = 2 #The index I want to omit
element_to_search_for = 2 #The element I'm searching for
array = [0,1,2,3,4] #A basic array, the original
new_array = array[:ommited_index]+array[ommited_index+1:] #Taking the ommited index out of the array via slicing
output = element_to_search_for in new_array #Checking if the element is in the array
print (output)

What can I do to copy this behavior in an OpenCL kernel?

This is also similar to a yellow letter in Wordle, which is actually the behavior I am trying to test for here.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source