Below is an example illustrating the use of MPI_Scan, where we have a histogram distributed across nodes in exp_pdf_i, and then calculate the cumulative frequency histogram (exp_cdf_i) across all nodes. Although this is a simple example using a few floating point sums as the reduce operation, MPI_Scan would be most useful when the reduce operation is expensive and where each partial result would then be used in another computation on a single process.