Optimising python rust interface is#26
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request refactors and optimizes the Python–Rust interface of the NumArray codebase. Key changes include the addition of statistical operations in a new statistics module, reorganized module structure with smaller files, and enhanced Python bindings and documentation configurations.
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| rustynum-rs/src/num_array/statistics.rs | Added statistical methods (mean, median, sort, etc.). |
| rustynum-rs/src/num_array/operations.rs | Minor cleanup of unused imports. |
| rustynum-rs/src/num_array/mod.rs | Reorganized module imports/exports. |
| rustynum-rs/src/num_array/linalg.rs | Updated internal module references. |
| rustynum-rs/src/num_array/impl_clone_from.rs | Added Clone and From implementations for NumArray. |
| rustynum-rs/src/num_array/constructors.rs | New constructors (zeros, ones, arange, linspace) added. |
| rustynum-rs/src/lib.rs | Consolidated re-exports of NumArray types. |
| mkdocs.yml, docs/api/index.md | Documentation configuration updates. |
| bindings/python/src/*.rs | Updated and extended Python bindings for various types. |
| bindings/python/src/array_u8.rs, array_f32.rs, array_f64.rs | Added/updated methods for Python NumArray wrappers. |
Comments suppressed due to low confidence (1)
rustynum-rs/src/num_array/statistics.rs:319
- The variable name 'max_array' is misleading in the context of testing the median_axis function. Consider renaming it to 'median_array' for clarity.
let max_array = array.median_axis(Some(&[0]));
| } | ||
|
|
||
| fn __imul__(&mut self, scalar: f64) -> PyResult<()> { | ||
| ///self.inner = self.inner.scale(scalar); |
There was a problem hiding this comment.
The imul method is a no-op with a commented-out implementation. Either implement in-place multiplication properly or remove the method to avoid confusion.
Suggested change
| ///self.inner = self.inner.scale(scalar); | |
| self.inner = &self.inner * scalar; // Perform in-place multiplication |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes