MCPcopy Create free account
hub / github.com/comaps/comaps / Rank

Method Rank

libs/coding/bwt.cpp:60–72  ·  view source on GitHub ↗

Returns the rank of the i-th symbol among symbols with the same value.

Source from the content-addressed store, hash-verified

58 // Returns the rank of the i-th symbol among symbols with the same
59 // value.
60 size_t Rank(size_t i) const
61 {
62 ASSERT_LESS(i, Size(), ());
63 if (i == 0)
64 return 0;
65
66 --i;
67 auto it = std::upper_bound(m_starts.begin(), m_starts.end(), i);
68 if (it == m_starts.begin())
69 return i;
70 --it;
71 return i - *it;
72 }
73
74private:
75 size_t const m_n;

Callers 1

RevBWTFunction · 0.80

Calls 3

SizeFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected