Tweak std/bzip2's "inverse of T" description

This commit is contained in:
Nigel Tao committed 2022-05-17 00:10:46 +10:00
1 parent 84ef91dda8
commit 2422997ee5
2 files changed
+15 -18

No files matched your search

+12 -15
View File
@@ -258,23 +258,20 @@ uncompressed text.
## Alternative BWT Inversion ## Alternative BWT Inversion
It's not in the BWT technical report, but instead of walking *I*, *T[I]*, It's not in the BWT technical report, but instead of walking *I*, *T[I]*,
*T[T[I]]*, etc, an alternative but equivalent algorithm starts with the *Index *T[T[I]]*, etc, an alternative but equivalent algorithm works on *U*, the
L T* table but then sorts the rows by *T*, modifying the *Index* and *T* inverse of the *T* vector. For example *T[4] == 2* and so *U[2] == 4*.
columns (to produce *Index2* and *T2*) but leaving the *L* column unchanged.
For example *Index == 4* matches *T == 2*, so *T2 == 2* matches *Index2 == 4*.
Index2 L T2 Index L T F U
1 c 0 0 c 4 a 1
3 a 1 1 a 0 a 3
4 r 2 2 r 5 a 4
5 a 3 3 a 1 b 5
0 a 4 4 a 2 c 0
2 b 5 5 b 3 r 2
Our original *I* value was 1, and when *T2* is 1, *Index2* is 3. Call this Calculate *U[I]*, *U[U[I]]*, *U[U[U[I]]]*, etc to give [3, 5, 2, 4, 0, 1].
value *I2*. Calculate *I2*, *Index2[I2]*, *Index2[Index2[I2]]*, etc to give [3, Indexing *L* with these values gives "abraca", the uncompressed text (without
5, 2, 4, 0, 1]. Indexing *L* with these values gives "abraca", the uncompressed being reversed).
text (without being reversed).
## Final Run Length Encoding ## Final Run Length Encoding
+3 -3
View File
@@ -67,7 +67,7 @@ pub struct decoder? implements base.io_transformer(
// bwt is the Burrows Wheeler Transform state. Per the README.md file, each // bwt is the Burrows Wheeler Transform state. Per the README.md file, each
// entry is a row with the low 8 bits holding the L column and the high 20 // entry is a row with the low 8 bits holding the L column and the high 20
// bits holding the Index2 column. The middle 4 bits are unused. // bits holding the U column. The middle 4 bits are unused.
// //
// The read_code_lengths and build_huffman_tree methods also re-purpose // The read_code_lengths and build_huffman_tree methods also re-purpose
// this buffer to temporarily hold up to 258 symbols' code lengths. // this buffer to temporarily hold up to 258 symbols' code lengths.
@@ -727,8 +727,8 @@ pri func decoder.invert_bwt!() {
i += 1 i += 1
} endwhile } endwhile
// Second data pass, but per the README.md file, calculate the Index2 // Second data pass, but per the README.md file, calculate the U column
// column instead of the T column calculated by SRC-RR-124.pdf. // instead of the BWT technical report's T column.
i = 0 i = 0
while i < this.block_size { while i < this.block_size {
assert i < 900000 via "a < b: a < c; c <= b"(c: this.block_size) assert i < 900000 via "a < b: a < c; c <= b"(c: this.block_size)