Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] potential ambiguity of sort in estimate scale #159

Open
democheng opened this issue Dec 14, 2022 · 0 comments
Open

[QUESTION] potential ambiguity of sort in estimate scale #159

democheng opened this issue Dec 14, 2022 · 0 comments

Comments

@democheng
Copy link

Have you read the documentation?

  • [√] Yes
  • [] No - then this issue will be closed.

Post your theoretical questions / usage questions here.

I found "void teaser::ScalarTLSEstimator::estimate" at line 21 in registration.cc is very similar to Marzullo's algorithm and Brooks–Iyengar algorithm

as described in Marzullo's algorithm

Sort the table by the offset. (If two tuples with the same offset but opposite types exist, indicating that one interval ends just as another begins, then a method of deciding which comes first is necessary. Such an occurrence can be considered an overlap with no duration, which can be found by the algorithm by putting type −1 before type +1. If such pathological overlaps are considered objectionable they can be avoided by putting type +1 before −1 in this case.)

To solve the potential ambiguity of sort, I rewrite the sort function like this:

  // ascending order
  std::sort(h.begin(), h.end(), [](std::pair<double, int> a, std::pair<double, int> b) { 
    if (a.first != b.first) {
      return a.first < b.first;
    } else {
      return a.second < b.second;
    }
     });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant