Skip to content

Adding subview_mut to MatrixMut - #1463

Merged
Aditya Krishnan (arkrishn94) merged 1 commit into
mainfrom
u/adkrishnan/subview-mut
Oct 6, 2026
Merged

Aditya Krishnan (arkrishn94) merged 1 commit into
mainfrom
u/adkrishnan/subview-mut

Conversation

@arkrishn94

@arkrishn94 Aditya Krishnan (arkrishn94) commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

This PR introduces a subview_mut method to the recently added MatrixMut trait so that we can copy data in bulk into "subviews" of a mutable matrix.

So copying data from a ref: Ref<'_, T> into a mut: Mut<'_, T> can be done with something like this -

let range = 0..ref.nrows();
let subview = mut.subview_mut(range).ok_or(panic!("incorrect range")); 
subview.as_mut_slice().copy_from_slice(ref.as_slice())

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation preserves existing layout and borrowing contracts, with tests covering range validation and nested writes.

Review effort: Balanced
Findings: None

What changed in this PR

Adds mutable row subviews to MatrixMut, enabling bulk writes into selected matrix rows.

Changes:

  • Adds subview_mut with range validation.
  • Extends tests for boundary cases, zero-column matrices, and nested mutations.
File Description
diskann-utils/​src/​views/​rowmajor.rs Implements mutable subviews and extends subview tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.92%. Comparing base (bab8136) to head (f33ae73).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1463   +/-   ##
=======================================
  Coverage   91.92%   91.92%           
=======================================
  Files         583      583           
  Lines      115876   115903   +27     
=======================================
+ Hits       106523   106549   +26     
- Misses       9353     9354    +1     
Flag Coverage Δ
miri 91.92% <100.00%> (+<0.01%) ⬆️
unittests 91.87% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
diskann-utils/src/views/rowmajor.rs 96.96% <100.00%> (+0.06%) ⬆️

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@arkrishn94
Aditya Krishnan (arkrishn94) merged commit 8bb80cf into main Oct 6, 2026
32 checks passed
@arkrishn94
Aditya Krishnan (arkrishn94) deleted the u/adkrishnan/subview-mut branch October 6, 2026 18:55
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.

5 participants