feat: implement parallel bitonic sort with proper power-of-2 padding (v0.2.0)

- Add rayon dependency for parallel processing
- Implement rayon::broadcast for proper TFHE server key distribution across threads
- Fix bitonic sort to handle non-power-of-2 input sizes by padding to nearest 2^k
- Add parallel execution for recursive calls and comparison operations
- Update API to accept encrypted max values for safe padding
- Add Send/Sync traits for EncryptedNeighbor to enable thread safety
- Modify perform_knn_selection to support bitonic sort requirements
- Bump version to 0.2.0

This resolves the bitonic sort correctness issue where non-power-of-2 array sizes
caused incorrect results. The algorithm now properly pads from 100 to 128 elements
and should produce deterministic, correct results.
This commit is contained in:
2025-07-27 20:02:13 +08:00
parent 8b47403cc0
commit ef4f0021cf
5 changed files with 98 additions and 19 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "hfe_knn"
version = "0.1.0"
version = "0.2.0"
edition = "2024"
[dependencies]
@@ -14,3 +14,4 @@ chrono = { version = "0.4", features = ["serde"] }
bincode = "2.0"
log = "0.4"
env_logger = "0.11"
rayon = "1.10"