ULDT-Codec is an open-source lossless multi-channel compression library powered by Exact Unimodular Lattice Decorrelation (ULDT). It bridges algebraic number theory and multi-channel signal compression using Lenstra–Lenstra–Lovász (LLL) lattice basis reduction over the unimodular group
General-purpose archivers (7-Zip, Zstandard, gzip) and audio codecs (FLAC, ALAC, WavPack) compress multi-channel data along one dimension at a time:
-
FLAC/ALAC: Run 1D temporal linear prediction (LPC) per channel independently (or 2-channel
$L \pm R$ Mid/Side). - Blosc/HDF5: Use byte-shuffling to transpose arrays, but apply zero cross-channel algebraic decorrelation.
-
Continuous PCA / KLT: Finds optimal orthogonal rotation matrices
$V \in O(d, \mathbb{R})$ , but requires lossy quantization because real matrix multiplication destroys bit-for-bit invertibility.
ULDT maps empirical cross-channel covariance minimization to Euclidean lattice basis reduction:
- It computes the Cholesky factor
$L$ of the empirical covariance matrix$\Sigma = L L^T$ . - It uses the LLL algorithm to discover an optimal integer transformation matrix
$U \in GL(d, \mathbb{Z})$ satisfying$\det(U) \in {-1, +1}$ . - Because
$\det(U) = \pm 1$ , the inverse matrix$U^{-1} = \pm \text{adj}(U)$ consists strictly of pure integers with zero fractional division. - Both forward transformation
$\mathbf{y} = U \mathbf{x}$ and reconstruction$\mathbf{x} = U^{-1} \mathbf{y}$ are exact algebraic automorphisms on$\mathbb{Z}^d$ , achieving up to 36.8% smaller compressed sizes than FLAC and 7-Zip with 100% bit-for-bit SHA-256 validation.
| Dataset Domain | Uncompressed | Raw LZMA-9 | FLAC Delta-2 + LZMA | ULDT Codec | ULDT vs Best Competitor | SHA-256 |
|---|---|---|---|---|---|---|
| 6D Flight IMU Telemetry | 240,000 B | 108,300 B | 107,140 B | 82,198 B | -24,942 B (+23.28%) | 100% Match |
| Financial Order Book (4-Level) | 240,000 B | 35,096 B | 34,732 B | 21,924 B | -12,808 B (+36.88%) | 100% Match |
| 4-Mass Mechanical Mesh | 144,000 B | 62,260 B | 46,336 B | 48,492 B | -4.65% (FLAC won) | 100% Match |
| Uniform Random Noise | 65,536 B | 65,600 B | 65,600 B | 65,680 B | Bounded Pass-through | 100% Match |
git clone https://github.com/ononymuos/uldt-codec.git
cd uldt-codec
pip install -r requirements.txtimport numpy as np
from uldt import ULDTCodec
# Multi-channel integer matrix of shape (d, N)
# e.g., 6 channels (accelerometer + gyroscope) with 10,000 time steps
X = np.random.randint(-1000, 1000, size=(6, 10000), dtype=np.int32)
# Compress to minimal ULDT payload
payload = ULDTCodec.encode_channels(X)
print(f"Original: {X.nbytes:,} bytes -> ULDT: {len(payload):,} bytes")
# Decompress bit-for-bit exact copy
reconstructed = ULDTCodec.decode_payload(payload)
assert np.array_equal(X, reconstructed)
print("100% bit-for-bit SHA-256 identical.")# Compress 4-channel interleaved binary data
python3 -m uldt.cli compress telemetry.bin telemetry.uldt -d 4 --dtype int32
# Decompress back to original binary
python3 -m uldt.cli decompress telemetry.uldt reconstructed.bin- Lenstra, A. K., Lenstra, H. W., & Lovász, L. (1982). Factoring polynomials with rational coefficients. Mathematische Annalen, 261(4), 515-534.
- Shannon, C. E. (1948). A Mathematical Theory of Communication. Bell System Technical Journal, 27(3), 379-423.
- Minkowski, H. (1896). Geometrie der Zahlen. Teubner, Leipzig.
MIT License. Copyright (c) 2026 Usama Baig.