Can mapreduce change the order of the elements in the output array?

1 visualización (últimos 30 días)
Nebitno
Nebitno el 26 de Jun. de 2016
Comentada: Nebitno el 26 de Jun. de 2016
I am using mapreduce to compute distances between pairs of points, and when I look at the output it appears that mapreduce sorted these distances differently. So, I was wondering whether mapreduce can indeed change the order of the elements in the output and what would be possible ways to avoid this. Thanks.

Respuestas (1)

Walter Roberson
Walter Roberson el 26 de Jun. de 2016
Yes, any change in the order of calculation of floating point values can result in different round off, and sorting is sensitive to the exact floating point representation. You can have the same issue with vectorization compared to looping, and you can have the same issue with parfor compared to for, and you can have the same issue if Mathworks changes the Just In Time (JIT) engine.
The way to avoid this is to do your distance calculations and comparisons in infinite precision. Depending on how you do your calculations, the Symbolic Toolbox might suffice for that. (Be warned that I encountered an calculation about a month ago for which calculating to over 200000 digits was not sufficient.)

Categorías

Más información sobre MapReduce en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by