Skip to content
Snippets Groups Projects

WIP: Resolve "std::set and std::map instead of std::list in wolf nodes"

Closes #213 (closed)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
46 double min_dt = 1e9;
47
48 for (auto frm_rit = rbegin(); frm_rit != rend(); frm_rit++)
45 //If frame_list_ is empty then closestKeyFrameToTimeStamp is meaningless
46 if(not frame_list_.empty())
49 47 {
50 double dt = std::fabs((*frm_rit)->getTimeStamp() - _ts);
51 if (dt < min_dt)
48 //Let me use shorter names for this explanation: lower_bound -> lb & upper_bound -> ub
49 //In the std they fulfill the following properties:
50 // lb is the first element such that ts <= lb, alternatively the smallest element that is NOT less than ts.
51 // ub is the first element such that ts < lb.
52 // The ub definition is fine, and what one would expect. On the other hand the lb definition is NOT the ACTUAL lower bound but the following position
53 // so, lb = lb_true + 1.
54 auto lower_bound = frame_list_.lower_bound(_ts);
55 auto upper_bound = frame_list_.upper_bound(_ts);
  • You can save 50% of search time by avoiding one of these calls, e.g. that on L55. The other iterator will be equal or equal+1 depending on the time stamp matching that of the KF or not, so with a simple if() you can set upper_bound from the info in the time stamps and the lower_bound.

  • Please register or sign in to reply
  • added 1 commit

    • 88981e5d - Remove call to upper_bound. Reuse lower_bound

    Compare with previous version

  • Please register or sign in to reply
    Loading