I have a 300x178 matrix and I want to find the minimum of each column of that matrix (1x178). Then I want that, on the location/pixel of the minimum value in each column, the sum is taken from all other pixels in that column. How can I do this using Fortran? Thanks!
Example:
1 4 6 3
2 6 7 4
5 1 5 7
becomes:
1 0 0 1
0 0 0 0
0 1 1 0
and eventually:
8 0 0 14
0 0 0 0
0 11 18 0
As @High Performance Mark has noted, the result is ambiguous if a column has more than one minimum - do you take the first, share them out, ... ?
If you take the first minimum then try the following.