Skip to content

Optimising python rust interface is#26

Merged
IgorSusmelj merged 10 commits into
mainfrom
optimising-python-rust-interface-is
May 31, 2025
Merged

Optimising python rust interface is#26
IgorSusmelj merged 10 commits into
mainfrom
optimising-python-rust-interface-is

Conversation

@IgorSusmelj
Copy link
Copy Markdown
Owner

Changes

  • Mostly refactoring of the rust and python codebase
    • Split up large files into smaller ones to make code more readable
    • Rearranged tests
    • Added more detailed python docstrings and type hints to make the bindings more user friendly
    • Update the API generated docs for Python

@IgorSusmelj IgorSusmelj requested a review from Copilot May 31, 2025 16:25
Copy link
Copy Markdown

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 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]));

Comment thread bindings/python/src/array_f64.rs Outdated
}

fn __imul__(&mut self, scalar: f64) -> PyResult<()> {
///self.inner = self.inner.scale(scalar);
Copy link

Copilot AI May 31, 2025

Choose a reason for hiding this comment

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

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

Copilot uses AI. Check for mistakes.
@IgorSusmelj IgorSusmelj merged commit 3392579 into main May 31, 2025
6 checks passed
@IgorSusmelj IgorSusmelj deleted the optimising-python-rust-interface-is branch May 31, 2025 17: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.

2 participants