Finding max, min, and mean/median in an multidimensional array

Discussion created by riza.guntur on Jun 28, 2009
Latest reply on Jul 16, 2009 by gaurav.garg

Dear all,

I have a problem like this:

float input[100][16];

I want to group each 5 rows of the input so I will have 20 of 5 rows each with 16 dimensions.

For each group, I need to find max, min, and mean/median within each dimension separately, so I get 16 of max, min, and mean/median for each group. The next step is rather confusing so I ask this first pass first.

Is there any ways to do it using Brook+? I thought of using reduce kernel.

reduce void
sum(float i<>, reduce float o<>
    o = o + i/(float)5;

for each 5 within a dimension in a group. But how? These each 5 separated by rows while reduce kernel operated in columns.

Is there anyway to do it by offset, for each 5 then reduce it to one? Yes I need to change the 2 dimensional array to 1 dimension but it is not hard.

Later will be compiled in the CPU for next operation.

As for max and min values haven't got any ideas yet. Anyone has a suggestion?

Thanks anyway.