Skip to content

feat(ivf): Add numpy array support for IVF assemble functions#287

Open
ibhati wants to merge 3 commits intomainfrom
ib/ivf_numpy
Open

feat(ivf): Add numpy array support for IVF assemble functions#287
ibhati wants to merge 3 commits intomainfrom
ib/ivf_numpy

Conversation

@ibhati
Copy link
Member

@ibhati ibhati commented Mar 13, 2026

This enables users to build IVF indices from in-memory numpy arrays without intermediate file I/O, improving performance for dynamic workflows.

  • Add assemble_from_clustering and assemble_from_file methods that accept numpy arrays directly (py_data parameter) in addition to file paths
  • Refactor assemble_dynamic_from_clustering to avoid double data copy:
    - Internal _impl function takes data by const reference
    - Smart dispatching detects ImmutableMemoryDataset and passes by reference
  • Add timing instrumentation for assemble operations
  • Add comprehensive tests for numpy array assembly in both IVF and DynamicIVF
  • Zero-copy path: numpy views passed directly without data duplication

ibhati added 2 commits March 13, 2026 11:13
- Add assemble_from_clustering and assemble_from_file methods that accept
  numpy arrays directly (py_data parameter) in addition to file paths
- Refactor assemble_dynamic_from_clustering to avoid double data copy:
  - Internal _impl function takes data by const reference
  - Smart dispatching detects ImmutableMemoryDataset and passes by reference
- Add timing instrumentation for assemble operations
- Add comprehensive tests for numpy array assembly in both IVF and DynamicIVF
- Zero-copy path: numpy views passed directly without data duplication

This enables users to build IVF indices from in-memory numpy arrays without
intermediate file I/O, improving performance for dynamic workflows.
@ibhati ibhati marked this pull request as ready for review March 13, 2026 18:45
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.

1 participant