Skip to content

Conversation

@hildebrandmw
Copy link
Contributor

Enable:

  1. Clone for Mat
  2. MatRef::to_owned (as an inherent method)
  3. MatMut::to_owned (as an inherent method)

All three of these require the underlying representation to implement NewCloned to perform the actual clone. This PR implements NewCloned for the Standard representation.

This is turning out necessary for use in multi-vector scenarios.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enables cloning functionality for the multi-vector matrix types in the quantization module. It introduces a new NewCloned trait that representations can implement to support creating owned Mat instances from borrowed views. The PR implements this trait for the Standard<T> representation and uses it to enable Clone for Mat<T>, as well as adding to_owned() methods for MatRef and MatMut.

Changes:

  • Introduced NewCloned trait for representations that support cloning from a view
  • Implemented NewCloned for Standard<T> where T: Copy
  • Added Clone implementation for Mat<T> where T: NewCloned
  • Added to_owned() inherent methods to MatRef and MatMut
  • Refactored NewOwned implementation to use a new box_to_mat helper method
  • Added comprehensive tests for all three cloning paths

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter
Copy link

codecov-commenter commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.00%. Comparing base (26fd1af) to head (89f0514).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #759      +/-   ##
==========================================
+ Coverage   88.99%   89.00%   +0.01%     
==========================================
  Files         428      428              
  Lines       78291    78346      +55     
==========================================
+ Hits        69677    69734      +57     
+ Misses       8614     8612       -2     
Flag Coverage Δ
miri 89.00% <100.00%> (+0.01%) ⬆️
unittests 89.00% <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-quantization/src/multi_vector/matrix.rs 97.53% <100.00%> (+0.22%) ⬆️

... and 1 file with indirect coverage changes

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

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.

2 participants