stdlib-js / google-summer-of-code

Google Summer of Code resources.
https://github.com/stdlib-js/stdlib
23 stars 5 forks source link

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

Open kgryte opened 5 months ago

kgryte commented 5 months ago

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 commented 3 months ago

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.