Skip to content

[multi-vector] Enable cloning of Mat and friends. - #759

Merged
Mark Hildebrand (hildebrandmw) merged 5 commits into
mainfrom
mhildebr/new-cloned
Feb 11, 2026
Merged

[multi-vector] Enable cloning of Mat and friends.#759
Mark Hildebrand (hildebrandmw) merged 5 commits into
mainfrom
mhildebr/new-cloned

Conversation

@hildebrandmw

Copy link
Copy Markdown
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.

CopilotAI 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.

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

Codecov Comments Bot (codecov-commenter) commented Feb 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.98%. Comparing base (26fd1af) to head (8fb5d7e).
⚠️ Report is 44 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@ Coverage Diff @@## main #759 +/- ##
==========================================
- Coverage 88.99% 88.98% -0.01% 
==========================================
Files 428 428 Lines 78291 78420 +129 ==========================================
+ Hits 69677 69785 +108 - Misses 8614 8635 +21 
FlagCoverage Δ
miri88.98% <100.00%> (-0.01%)⬇️
unittests88.98% <100.00%> (-0.01%)⬇️

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

Files with missing linesCoverage Δ
diskann-quantization/src/multi_vector/matrix.rs97.53% <100.00%> (+0.22%)⬆️

... and 7 files with indirect coverage changes

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

Comment threaddiskann-quantization/src/multi_vector/matrix.rs
@hildebrandmw
Mark Hildebrand (hildebrandmw) merged commit 16cbd93 into mainFeb 11, 2026
20 checks passed
@hildebrandmw
Mark Hildebrand (hildebrandmw) deleted the mhildebr/new-cloned branch February 11, 2026 21:14
Mark Hildebrand (hildebrandmw) added a commit that referenced this pull request Feb 13, 2026
## What's Changed
### API Breaking Changes
* Remove the `experimental_avx512` feature. by @hildebrandmw in
#732
* Use VirtualStorageProvider::new_overlay(test_data_root()) in tests by
@Copilot in #726
* save and load max_record_size and leaf_page_size for bftrees by
@backurs in #724
* [multi-vector] Verify `Standard` won't overflow in its constructor. by
@hildebrandmw in #757
* VirtualStorageProvider: Make new() private, add new_physical by
@Copilot in #764
* [minmax] Refactor full query by @arkrishn94 in
#770
* Bump diskann-quantization to edition 2024. by @hildebrandmw in
#772
### Additions
* [multi-vector] Enable cloning of `Mat` and friends. by @hildebrandmw
in #759
* adding bftreepaths in mod.rs by @backurs in
#775
* [quantization] Add `as_raw_ptr`. by @hildebrandmw in
#774
### Bug Fixes
* Fix `diskann` compilation without default-features and add CI tests.
by @hildebrandmw in #722
### Docs and Comments
* Updating the benchmark README to use diskann-benchmark by @bryantower
in #709
* Fix doc comment: Windows line endings are \r\n not \n\r by @Copilot in
#717
* Fix spelling errors in streaming API documentation by @Copilot in
#715
* Add performance diagnostic to `diskann-benchmark` by @hildebrandmw in
#744
* Add agents.md onboarding guide for coding agents by @Copilot in
#765
* [doc] Fix lots of little typos in `diskann-wide` by @hildebrandmw in
#771
### Performance
* [diskann-wide] Optimize `load_simd_first` for 8-bit and 16-bit element
types. by @hildebrandmw in #747
### Dependencies
* Bump bytes from 1.11.0 to 1.11.1 by @dependabot[bot] in
#723
* [diskann] Add note on the selection of `PruneKind` in
`graph::config::Builder`. by @hildebrandmw in
#734
* [diskann-providers] Remove the LRU dependency and make `vfs` and
`serde_json` optional. by @hildebrandmw in
#733
### Infrastructure
* Add initial QEMU tests for `diskann-wide`. by @hildebrandmw in
#719
* [CI] Skip coverage for Dependabot. by @hildebrandmw in
#725
* Add miri test coverage to CI workflow by @Copilot in
#729
* [CI] Add minimal ARM checks by @hildebrandmw in
#745
* Enable CodeQL security analysis by @Copilot in
#754
## New Contributors
* @backurs made their first contribution in
#724
* @arkrishn94 made their first contribution in
#770
**Full Changelog**:
0.45.0...0.46.0
Sign up for freeto 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

@hildebrandmw@codecov-commenter@metajack@arkrishn94