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

Function BWT

libs/coding/bwt.cpp:138–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136namespace coding
137{
138size_t BWT(size_t n, uint8_t const * s, uint8_t * r)
139{
140 std::vector<size_t> sa(n);
141 base::Skew(n, s, sa.data());
142
143 size_t result = 0;
144 for (size_t i = 0; i < n; ++i)
145 {
146 if (sa[i] != 0)
147 {
148 r[i] = s[sa[i] - 1];
149 }
150 else
151 {
152 result = i;
153 r[i] = s[n - 1];
154 }
155 }
156 return result;
157}
158
159size_t BWT(std::string const & s, std::string & r)
160{

Callers 3

EncodeAndWriteBlockMethod · 0.85
RevRevBWTFunction · 0.85
UNIT_TESTFunction · 0.85

Calls 4

SkewFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45
assignMethod · 0.45

Tested by 2

RevRevBWTFunction · 0.68
UNIT_TESTFunction · 0.68