I am trying to use MPI_REDUCE in C (or c++) to find the minimum (and the index) in an array. I have this working for regular array, but now I want to switch to one in which the value is dynamically computed. i.e the value of arr[n] is calculated by calling fun(n). Due to memory problems I cannot compute all values an put them in a regular array.
How can I achieve this?
Thanks in advance,