Ndarray views of numpy arrays

Open
#137 15 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
numpy, r, rust

Research direction

Start by reviewing the scirust commit linked in the issue and the current ndarray APIs for constructing views from external data. Define what dtype, dimensions, strides, and safety checks are required for NumPy arrays and R matrices, then identify tests that demonstrate accepted and rejected inputs.

Written by the indexing model from the issue text.

Description

help wanted

I write numerical code in Rust, but use Python and sometimes R to drive them (e.g., plot graphs comparing performance for different algorithms). This involves exporting an extern function that accepts pointers to (parts of) numpy arrays or R matrices, then treating these as Rusty datastructures (I implemented a basic version of for scirust in [1]).

As a user it would be great to have a function to which I pass a pointer to the raw Numpy array object (without doing any conversions in Python), and get back a view I can use safely. This involves looking at the Numpy array for the dtype, dimension, strides etc. Since ndarray encodes some of these in the type, a generic function that merely tests that the NP array passed conforms to its expectations (or panics with highly informative debug information) seems best.

Same applies to R, with different particulars of course.

Or is there a way to do this already?

[1] https://github.com/daniel-vainsencher/scirust/commit/48c9109abae32db06217576f03c22a18ad39e5d6 which doesn't compile on current nightly rust, sadly.

Dominant language
Rust
Stars
4.3k
Forks
391
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-ndarray/ndarray

All issues in rust-ndarray/ndarray

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.