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

1
Cargo.lock generated
View File

@@ -419,6 +419,7 @@ dependencies = [
"env_logger",
"log",
"rand",
"rayon",
"serde",
"serde_json",
"tfhe",