[GRASS-git] [OSGeo/grass] c7928b: r.univar: Use Kahan sum to avoid floating point er...
Chung-Yuan Liang
noreply at github.com
Sat May 24 10:46:30 PDT 2025
Branch: refs/heads/main
Home: https://github.com/OSGeo/grass
Commit: c7928beda9aad46a8375ef45a9e910377aa00811
https://github.com/OSGeo/grass/commit/c7928beda9aad46a8375ef45a9e910377aa00811
Author: Chung-Yuan Liang <77927944+cyliang368 at users.noreply.github.com>
Date: 2025-05-24 (Sat, 24 May 2025)
Changed paths:
M python/grass/gunittest/testsuite/test_assertions.py
M raster/r.mfilter/testsuite/test_r_mfilter.py
M raster/r.neighbors/testsuite/test_r_neighbors.py
M raster/r.resamp.filter/testsuite/test_r_resamp_filter.py
M raster/r.resamp.interp/testsuite/test_r_resamp_interp.py
M raster/r.texture/testsuite/test_rtexture.py
M raster/r.texture/testsuite/test_rtexture_parallel.py
M raster/r.univar/r.univar_main.c
A raster/r.univar/testsuite/test_r_univar_parallel.py
Log Message:
-----------
r.univar: Use Kahan sum to avoid floating point errors (#5750)
Univar sums values across large amounts of numbers, so the floating point errors could be huge if a naive sum is applied.
This PR introduces Kahan sum to solve this problem in `r.univar`. The testing reference numbers derived from the previous `r.univar` implementation are also updated.
* modify the precision and some wrong reference numbers
* set the precision requirement to 1e-10
* use KahanSum and create test for multithreads
* make sure the calculation/output match the raster type
* update testing reference based on corrected numbers
* use lower case and underscore for the function name
* simplify the testing script of r.univar parallel
* update reference numbers in testing files
* make kahan some as a static fucntion, move the function body to the bottom
* update reference number for testing
* remove unused comment
---------
Co-authored-by: Māris Nartišs <maris.gis at gmail.com>
To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications
More information about the grass-commit
mailing list