operations between jagged arrays and scalars
Hi, this is the proof of concept discussed at #3537
It's more inline with what Jos and Glen suggested as my initial idea was flawed. This PR only shows two main changes.
- refactors matAlgo14xDs to use it's map method and includes a hack to make the matrix creation faster.
- makes a new matAlgo15xAs to map arrays that can be jagged or non homogeneous and there is no need to convert to matrix and then back to array.
My expectation is that all operations between Matrix|Array and scalar should be faster.
The new functionality is that it's possible to do stuff like
math.add([1,[2,3]], 1)
math.config({matrix:"Array"})
math.evaluate("[1,[2,3]] + 1")
Nice! This actually simplifies the code since you can "just" use the map function.
What are the next steps? Add some unit tests for jagged inputs, update docs, and see what the performance impact is?
Yes exactly, I will proceed with the next steps in the following weeks.
Maybe later I will come back to broadcasting jagged arrays.