google-summer-of-code icon indicating copy to clipboard operation
google-summer-of-code copied to clipboard

[Idea]: achieve ndarray API parity with built-in JavaScript arrays

Open kgryte opened this issue 4 months ago • 1 comments

Idea

Built-in JavaScript arrays (and typed arrays) have a number of methods for creating, transforming, and manipulating array contents (e.g., forEach, map, reverse, slice, filter, etc). These APIs provide base level functionality forming a default vocabulary for working with array data.

The goal of this idea is to create functional analogs of array methods for working with ndarrays, which are efficient data structures for operating on multi-dimensional data. The main difficulty in implementing analogs is in ensuring efficient iteration of non-contiguous data. The main patterns for such iteration have been established in stdlib, but work remains to apply such patterns for top-level array-equivalent APIs.

Expected Outcomes

Users will be able to use functional APIs (exposed as part of individual packages) for operating on ndarrays in a manner similar to how users can use prototype methods available on built-in arrays and typed arrays.

Involved Software

No other software is necessary.

Prerequisite Knowledge

JavaScript, Node.js.

For APIs not accepting callbacks, certain kernels can be implemented in C, as time and scope allow.

Difficulty

Intermediate. Writing the loop kernels can be involved, but, once understood, are straightforward to apply.

Project Length

90/175/350 hours. Can be scoped accordingly. Scope can be expanded to implement additional ndarray kernels outside of Array method equivalents.

Potential Mentors

@kgryte @Planeshifter @steff456 @rreusser

kgryte avatar Feb 06 '24 04:02 kgryte

To reiterate, and as indicated in the OP, no methods should be added to the ndarray.prototype. An ndarray object is intended, and should remain, a minimal wrapper which simply describes meta data. All behavior should be left to functional APIs in the ndarray namespace.

kgryte avatar Mar 21 '24 18:03 kgryte