tisonkun opened a new pull request, #355:
URL: https://github.com/apache/datasketches-rust/pull/355
## Summary
The CPC compression and ICON estimator modules rely on static lookup tables
ported from the reference C/C++/Java implementations
(`LENGTH_LIMITED_UNARY_ENCODING_TABLE65`,
`ENCODING_TABLES_FOR_HIGH_ENTROPY_BYTE`, `COLUMN_PERMUTATIONS_FOR_ENCODING`,
`ICON_POLYNOMIAL_COEFFICIENTS`, and the confidence bound tables), while Kevin
J. Lang's offline OCaml and polynomial-fitting generators were never checked
into upstream DataSketches repositories.
Following the pattern in `kxp_byte_lookup.rs`, this PR reconstructs the
offline table generators and the exact FM85 ICON reference estimator inside
`#[cfg(test)]`, documenting which original file each generator corresponds to
and how its parameters were derived from the static tables, header comments,
and FM85 theory:
| Module | Static Tables / Constants
| Original Source Reference
| Verification in `#[cfg(test)]`
|
| --------------------- |
-----------------------------------------------------------------------------------------------------
| ------------------------------------------------------------------- |
--------------------------------------------------------------------------------------------------------------------------------------------
|
| `compression_data.rs` | `LENGTH_LIMITED_UNARY_ENCODING_TABLE65`
| `columnProbabilities.ml` +
`generateHuffmanCodes.ml` | 1-to-1 bit-exact match (65 entries)
+ exact `2.0` entropy and `2.02490234375` expected code length
|
| `compression_data.rs` | `ENCODING_TABLES_FOR_HIGH_ENTROPY_BYTE`
| `columnProbabilities.ml` +
`generateHuffmanCodes.ml` | 1-to-1 bit-exact match across all
`22 * 256` entries (`K = 2^32` finite-`K` model + 12-bit Package-Merge +
canonical LSB-first Huffman) |
| `compression_data.rs` | `COLUMN_PERMUTATIONS_FOR_ENCODING`
|
`generatePermutationsForSLIDING.ml` | 1-to-1
exact match across all `16 * 56` entries (`c/k = 6.0 + phase`, descending
surprise-probability ranking with exact `exp` tail `p_0`) |
| `compression_data.rs` | `*_DECODING_*` tables
| `fm85Compression.c` /
`CompressionData.java` | 1-to-1 exact inverse
verification
|
| `estimator.rs` | `ICON_POLYNOMIAL_COEFFICIENTS`,
`0.7940236163830469`, `2.0`, `66.774757` |
`iconEstimator.c` / `icon_estimator.hpp` / `IconEstimatorTest.java` | Exact
FM85 ICON inversion sweep (`lg_k = 4..=26`), `sqrt(2) * exp(-gamma)` theory
check, and Householder QR least-squares reconstruction |
| `estimator.rs` | `ICON_ERROR_CONSTANT`, `HIP_ERROR_CONSTANT`,
`ICON_{LOW,HIGH}_SIDE_DATA`, `HIP_{LOW,HIGH}_SIDE_DATA` | `cpc_confidence.hpp`
/ `CpcConfidence.java` | Exact closed-form asymptotic
constants (`ln 2`, `sqrt((ln 2) / 2)`) and ~1M-trial empirical Monte Carlo
table invariants |
## Test Plan
- `cargo x lint`
- `cargo x check`
- `cargo x test`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]