Examples:
reshape([1, 2, 3, 4, 5, 6], [2, 3])
[[1, 2, 3], [4, 5, 6]]
reshape([[1, 2], [3, 4]], [1, 4])
[[1, 2, 3, 4]]
reshape([[1, 2], [3, 4]], [4])
[1, 2, 3, 4]
math.reshape([1, 2, 3, 4, 5, 6], [2, 3])
// returns Array [[1, 2, 3], [4, 5, 6]]
math.reshape([[1, 2], [3, 4]], [1, 4])
// returns Array [[1, 2, 3, 4]]
math.reshape([[1, 2], [3, 4]], [4])
// returns Array [1, 2, 3, 4]
const x = math.matrix([1, 2, 3, 4, 5, 6, 7, 8])
math.reshape(x, [2, 2, 2])
// returns Matrix [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]
math.reshape([1, 2, 3, 4], [-1, 2])
// returns Matrix [[1, 2], [3, 4]]
It seems to be related with either the order or the alignment of lines 30 and 31 in here
When evaluating
help(reshape)the examples do not show the use of wlidcard-1I see on the docs that an example is shown but with different alignment
It seems to be related with either the order or the alignment of lines 30 and 31 in here
mathjs/src/function/matrix/reshape.js
Line 30 in c51d263
I don't know if this behavior is as intended but please review