Expand description
§Haagenti
Next-generation compression library for the Daemoniorum ecosystem.
Haagenti provides a unified interface for multiple compression algorithms with SIMD acceleration and streaming support.
§Quick Start
ⓘ
use haagenti::{Codec, Lz4Codec, ZstdCodec};
// LZ4 - fastest compression/decompression
let lz4 = Lz4Codec::new();
let compressed = lz4.compress(b"Hello, Haagenti!")?;
let original = lz4.decompress(&compressed)?;
// Zstd - balanced speed and ratio
let zstd = ZstdCodec::new();
let compressed = zstd.compress(b"Hello, Haagenti!")?;§Available Algorithms
| Algorithm | Feature | Speed | Ratio | Best For |
|---|---|---|---|---|
| LZ4 | lz4 | ⚡⚡⚡ | ⭐⭐ | Real-time, databases |
| Zstd | zstd | ⚡⚡ | ⭐⭐⭐ | General purpose |
| Brotli | brotli | ⚡ | ⭐⭐⭐⭐ | Web, static content |
| Deflate | deflate | ⚡⚡ | ⭐⭐⭐ | Compatibility |
§Feature Flags
lz4- LZ4 compression (default)zstd- Zstandard compression (default)brotli- Brotli compression (default)deflate- Deflate/Gzip/Zlib compression (default)simd- SIMD-accelerated primitives (default)stream- Streaming I/O adapters (default)full- All features enabled
Re-exports§
pub use compressive::CompressiveSpectralDecoder;pub use compressive::CompressiveSpectralEncoder;pub use spectral_analysis::Compressibility;pub use spectral_analysis::SpectralAnalyzer;pub use spectral_analysis::SpectralStats;pub use adaptive::AdaptiveBatchEncoder;pub use adaptive::AdaptiveEncodingMeta;pub use adaptive::AdaptiveSpectralDecoder;pub use adaptive::AdaptiveSpectralEncoder;pub use adaptive::BatchEncodingStats;pub use svd_compression::SvdCompressedWeight;pub use svd_compression::SvdDecoder;pub use svd_compression::SvdEncoder;pub use hybrid_compression::CompressionMethod;pub use hybrid_compression::HybridCompressedWeight;pub use hybrid_compression::HybridCompressionStats;pub use hybrid_compression::HybridDecoder;pub use hybrid_compression::HybridEncoder;pub use hybrid_compression::TensorType;pub use mixed_precision::MixedPrecisionDecoder;pub use mixed_precision::MixedPrecisionEncoder;pub use mixed_precision::MixedPrecisionWeight;pub use importance::ImportanceCompressedWeight;pub use importance::ImportanceGuidedDecoder;pub use importance::ImportanceGuidedEncoder;pub use importance::ImportanceMap;pub use importance::Sensitivity;pub use importance::TensorImportance;pub use streaming::LoadPriority;pub use streaming::LoadStatus;pub use streaming::ProgressCallback;pub use streaming::ProgressiveLoadConfig;pub use streaming::StreamingModelLoader;pub use streaming::StreamingTensorLoader;pub use pipeline::CompressionCheckpoint;pub use pipeline::CompressionConfig;pub use pipeline::CompressionPipeline;pub use pipeline::CompressionReport;pub use pipeline::IncrementalHctWriter;pub use pipeline::PipelineConfig;pub use pipeline::QualityReport;pub use pipeline::QualitySampler;pub use pipeline::QualitySummary;pub use pipeline::ShardReader;pub use pipeline::ShardStatus;pub use pipeline::TensorEntry;pub use pipeline::TensorIndexEntry;pub use pipeline::TensorResult;pub use pipeline::TensorStatus;pub use hct_test_vectors::all_stress_vectors;pub use hct_test_vectors::all_test_vectors;pub use hct_test_vectors::cosine_similarity;pub use hct_test_vectors::reference_dct_2d;pub use hct_test_vectors::reference_idct_2d;pub use hct_test_vectors::HctTestVector;
Modules§
- adaptive
- Adaptive Spectral Encoding
- compressive
- Compressive Spectral Encoding for HoloTensor
- entropy
- Fast entropy fingerprinting for compression decisions.
- hct_
test_ vectors - HCT Specification Test Vectors
- holotensor
- Re-export of HoloTensor format from haagenti-hct.
- hybrid_
compression - Hybrid Compression Pipeline
- importance
- Importance-Guided Compression
- mixed_
precision - Mixed Precision Compression
- pipeline
- Production pipeline for large model compression with checkpointing.
- simd
- SIMD-accelerated primitives.
- spectral_
analysis - Spectral Analysis for Adaptive Retention
- stream
- Streaming compression adapters.
- streaming
- Streaming decompression for progressive inference loading.
- svd_
compression - SVD-based Compression for Neural Network Weights
- tensor
- Re-export of HCT tensor format from haagenti-hct.
Structs§
- Block
Index - Block index entry.
- Block
Index V2 - Block index entry with optional checksum for v2.
- Brotli
Codec - Brotli codec combining compression and decompression.
- Brotli
Compressor - Brotli compressor.
- Brotli
Decompressor - Brotli decompressor.
- Checksum
Error - Checksum validation error.
- Compression
Stats - Statistics from a compression/decompression operation.
- Deflate
Codec - Raw DEFLATE codec.
- Deflate
Compressor - Raw DEFLATE compressor.
- Deflate
Decompressor - Raw DEFLATE decompressor.
- Fragment
Index Entry - Index entry for a fragment (24 bytes).
- Gzip
Codec - Gzip codec (DEFLATE with gzip wrapper).
- Gzip
Compressor - Gzip compressor.
- Gzip
Decompressor - Gzip decompressor.
- HctCompression
Stats - Statistics from compression.
- HctHeader
- Header for the compressed tensor format.
- HctReader
- Reader for compressed tensor files.
- HctReader
V2 - Reader for HCT v2 files with checksum validation.
- HctWriter
- Writer for compressed tensor files.
- HctWriter
V2 - Writer for HCT v2 format with checksum and quantization support.
- Holo
Fragment - A holographic fragment containing partial tensor data.
- Holo
Tensor Decoder - Holographic tensor decoder.
- Holo
Tensor Encoder - Holographic tensor encoder.
- Holo
Tensor Header - HoloTensor file header (88 bytes base + variable).
- Holo
Tensor Reader - Reader for deserializing HoloTensor data from a stream.
- Holo
Tensor Writer - Writer for serializing HoloTensor data to a stream.
- Lrdf
Decoder - Low-Rank Distributed Factorization decoder.
- Lrdf
Encoder - Low-Rank Distributed Factorization encoder.
- Lz4Codec
- LZ4 codec combining compression and decompression.
- Lz4Compressor
- LZ4 compressor.
- Lz4Decompressor
- LZ4 decompressor.
- Quality
Curve - Quality prediction curve for reconstruction.
- Quantization
Metadata - Quantization metadata for HCT v2.
- RphDecoder
- Random Projection Holography decoder.
- RphEncoder
- Random Projection Holography encoder.
- Seeded
Rng - Simple xorshift64 PRNG for reproducible random projections.
- Spectral
Decoder - Spectral holographic decoder.
- Spectral
Encoder - Spectral holographic encoder using DCT.
- Zlib
Codec - Zlib codec (DEFLATE with zlib wrapper).
- Zlib
Compressor - Zlib compressor.
- Zlib
Decompressor - Zlib decompressor.
- Zstd
Codec - Zstandard codec combining compression and decompression.
- Zstd
Compressor - Zstandard compressor.
- Zstd
Decompressor - Zstandard decompressor.
- Zstd
Dict Compressor - Dictionary-aware compressor
- Zstd
Dict Decompressor - Dictionary-aware decompressor
- Zstd
Dictionary - A Zstandard dictionary for compression/decompression
Enums§
- Algorithm
- Supported compression algorithms.
- Compression
Algorithm - Compression algorithm identifier.
- Compression
Level - Compression level presets.
- DType
- Data type identifier.
- Error
- Compression error types.
- Holographic
Encoding - Holographic encoding scheme.
- Quantization
Scheme - Quantization scheme identifier.
Constants§
- DEFAULT_
BLOCK_ SIZE - Default block size (16 KB uncompressed). Note: 16KB chosen for compatibility with haagenti-zstd which has issues at larger sizes
- FLAG_
BLOCK_ CHECKSUMS - Flag: Per-block checksums present (XXH3-64 for each block).
- FLAG_
HEADER_ CHECKSUM - Flag: Header checksum present (XXH3-64).
- FLAG_
HOLOGRAPHIC - Flag: Holographic encoded data (HoloTensor format). When set, the HCT file contains holographic fragments instead of raw blocks. The fragment data follows the HoloTensorHeader structure.
- FLAG_
QUANTIZATION - Flag: Quantization metadata present.
- FLAG_
TENSOR_ NAME - Flag: Tensor name embedded in extended header.
- HCT_
MAGIC - Magic bytes for the HCT format.
- HCT_
VERSION - Format version 1 (original).
- HCT_
VERSION_ V2 - Format version 2 (with checksums and quantization metadata).
- HOLO_
FLAG_ ESSENTIAL_ FIRST - Flag: Essential data replicated in fragment 0.
- HOLO_
FLAG_ FRAGMENT_ CHECKSUMS - Flag: Per-fragment checksums present.
- HOLO_
FLAG_ HEADER_ CHECKSUM - Flag: Header checksum present.
- HOLO_
FLAG_ INTERLEAVED - Flag: Coefficients interleaved for streaming.
- HOLO_
FLAG_ QUALITY_ CURVE - Flag: Quality curve coefficients present.
- HOLO_
FLAG_ QUANTIZATION - Flag: Quantization metadata present.
- HOLO_
MAGIC - Magic bytes for HoloTensor format: “HTNS”
- HOLO_
VERSION - HoloTensor format version.
Traits§
- Codec
- Combined codec for both compression and decompression.
- Compressor
- One-shot compression operations.
- Decompressor
- One-shot decompression operations.
- Dictionary
Compressor - Dictionary-based compression for improved ratios on similar data.
- Dictionary
Decompressor - Dictionary-based decompression.
Functions§
- compress
- Compress data using the specified algorithm.
- compress_
file - Compress a tensor file to HCT format.
- compress_
with_ level - Compress data using the specified algorithm and level.
- dct_1d
- 1D Discrete Cosine Transform Type-II using FFT.
- dct_2d
- 2D DCT via separable 1D transforms (row then column).
- decode_
from_ file - Read and decode tensor data from a file in one step.
- decode_
from_ file_ progressive - Read and decode tensor data with progressive quality target.
- decompress
- Decompress data using the specified algorithm.
- detect_
algorithm - Auto-detect algorithm from compressed data header.
- encode_
to_ file - Encode and write tensor data to a file in one step.
- idct_1d
- 1D Inverse Discrete Cosine Transform Type-II (aka DCT-III).
- idct_2d
- 2D IDCT via separable 1D transforms.
- open_
holotensor - Open a HoloTensor file for progressive reading.
- read_
holotensor - Read a HoloTensor from a file.
- write_
holotensor - Write a HoloTensor to a file.
Type Aliases§
- Result
- Result type alias for compression operations.