In a vector processing system for processing a plurality of values belonging to a data set, the vector processing system comprising at least an input vector having a number of elements with a unique index assigned to each element, the indexes assigned in an ascending order, the ascending order corresponding to the position of the elements in the input vector, a method, implemented as single instruction multiple data (SIMD) instructions, for discovering multiple instances of recurring values within the input vector, comprising:
- loading the values to the input vector;
- selecting each element of the input vector;
- comparing each selected element with all elements of the input vector having an index lower than the index of the selected element, to calculate the number of matches for the selected element, wherein the number of matches is the number of elements having the same value as the selected element;
- and
- generating a first output vector of the same number of elements as the input vector and the same indexes, wherein each element of the input vector corresponds to the element of the first output vector having the same index, wherein each element of the first output vector has a value equal to the number of matches calculated for the corresponding element of the input vector.