nicolaspanel / numjs

Like NumPy, in JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support -1 parameter for numjs.reshape

ishaantaylor opened this issue · comments

-1 as a parameter (one dimension of the shape) of reshape infers the size of the resulting reshaped array with the other shape parameter and the length

From scipy.org's numpy docs

newshape : int or tuple of ints
The new shape should be compatible with the original shape. If an integer, then the result will be a 1-D array of that length. One shape dimension can be -1. In this case, the value is inferred from the length of the array and remaining dimensions.

Would be happy to contribute

Hi @ishaantaylor and sorry for the delay.
As you mention it is not supported right now but I would be please to merge a PR :)
Best regards
PS: make sure to include unit tests