Draft
Conversation
1 task
…ate_vectors_with_norm with diskann-utils Agent-Logs-Url: https://github.com/microsoft/DiskANN/sessions/c5ece162-8de7-442b-bdc3-cdeb0d839c13 Co-authored-by: arrayka <1551741+arrayka@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/DiskANN/sessions/c5ece162-8de7-442b-bdc3-cdeb0d839c13 Co-authored-by: arrayka <1551741+arrayka@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Remove utils/math_util.rs to simplify codebase
Remove Apr 8, 2026
utils/math_util.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
math_util.rswas a grab-bag module mixing k-means support utilities with vector generation helpers. This PR relocates each function to where it logically belongs and removes the file.Changes
Moved to
kmeans.rs:POINTS_PER_CHUNK,PivotContainer,compute_vec_l2sq,compute_vecs_l2sq,compute_closest_centers_in_block,compute_closest_centers,process_residuals, and their tests. These were already k-means internals;kmeans.rswas importing them frommath_utilvia a circular-feeling cross-module reference.Replaced
generate_vectors_with_normwithdiskann_utils::sampling::WithApproximateNorm:random_data_generator.rs): usesf32::with_approximate_norm(dim, radius, rng)directly.diskann_async.rssphere tests): the existingWithApproximateNormuses a uniform distribution (vs. the original Gaussian), which changes the spherical point distribution and broke Cosine-distance ANN ordering tests. Replaced with inline Gaussian sampling viarand_distr::StandardNormalto preserve exact test semantics.Dropped
convert_usize_to_u64: trivial inline cast (value as u64), not used outside the module.Updated
mod.rs: removedpub mod math_utiland its re-exports; the moved functions are now re-exported fromkmeans.