Is there such a thing like
af::array groupedMax= af::Max(myValues, fromIndices, toIndices);
For example,
myValues= {random values}
fromIndices = {2, 7, 5}
toIndices = {10, 9, 12}
The result should be
groupedMax[0] will be max between myValues[2] and myValues[10]
groupedMax[1] will be max between myValues[7] and myValues[9]
groupedMax[2] will be max between myValues[5] and myValues[12]
Is this achievable? If not, any idea how to do this super fast on ArrayFire?
Edit: Here is a rough single threaded code I want to achieve.
vector<double> groupedMaxValues(fromIndices.size());
for(int g=0; g<fromIndices.size(); g++)
{
double maxVal = 0;
for(int i=fromIndices[g]; i<=toIndices[g]; i++)
{
if(maxVal < myValues[i])
{
maxVal = myValues[i];
}
}
groupedMaxValues[g] = maxVal;
}