forked from openMVG/openMVG
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[numeric] minMaxMeanMedian speed improvement openMVG#1398
- Add unit test - Use nth_element and min/max_element to minimize the number of operation A faster solution could be to use somthing like the following: ``` T min = a[0], max = a[0]; std::nth_element(a.begin(), a.begin() + n, a.end(), [&](T lhs, T rhs) { min = std::min(min, std::min(lhs, rhs)); max = std::max(max, std::max(lhs, rhs)); return lhs < rhs; }); ``` but since nth_element is not guaranted to look to all element in the array I prefer rely on 3 STL operation.
- Loading branch information
Showing
2 changed files
with
29 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters