Skip to content

Remove utils/math_util.rs#921

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/remove-utils-math-util
Draft

Remove utils/math_util.rs#921
Copilot wants to merge 3 commits intomainfrom
copilot/remove-utils-math-util

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

math_util.rs was 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.rs was importing them from math_util via a circular-feeling cross-module reference.

  • Replaced generate_vectors_with_norm with diskann_utils::sampling::WithApproximateNorm:

    • Production path (random_data_generator.rs): uses f32::with_approximate_norm(dim, radius, rng) directly.
    • Test path (diskann_async.rs sphere tests): the existing WithApproximateNorm uses 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 via rand_distr::StandardNormal to preserve exact test semantics.
  • Dropped convert_usize_to_u64: trivial inline cast (value as u64), not used outside the module.

  • Updated mod.rs: removed pub mod math_util and its re-exports; the moved functions are now re-exported from kmeans.

Copilot AI linked an issue Apr 8, 2026 that may be closed by this pull request
1 task
Copilot AI and others added 2 commits April 8, 2026 01:10
…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>
Copilot AI changed the title [WIP] Remove utils/math_util.rs to simplify codebase Remove utils/math_util.rs Apr 8, 2026
Copilot AI requested a review from arrayka April 8, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get rid of utils/math_util.rs

2 participants