Future plans for matrices #2702
Replies: 7 comments 8 replies
-
Oh btw, I was wondering a bit why this uses python style matrix format, rather than the matlab matrix format when defining matricies?
|
Beta Was this translation helpful? Give feedback.
-
The expression parser of math.js supports both these styles, but when defining a matrix in plain JavaScript you will have to use nested arrays. |
Beta Was this translation helpful? Give feedback.
-
😂 so many plans so little time. How would closing this issue and opening it again in a new issue help? |
Beta Was this translation helpful? Give feedback.
-
hm yeah. Anyway I prefer keeping the current issue open, and keep the discussion in a single thread. |
Beta Was this translation helpful? Give feedback.
-
Relevant to this discussion is whether it's worth continuing to (re-)implement matrix/linear algebra algorithms directly in mathjs anyway. This question came up for me in the fix to #2879 which surfaced the new issue #3036. Seems to me that all this has done before, and mathjs would be better off leveraging existing solutions than rolling its own. One specific possibility seems to be https://github.com/mateogianolio/vectorious, which seems to also afford the possibility of using BLAS/LAPACK under the hood. |
Beta Was this translation helpful? Give feedback.
-
Another area of improvement would be related to matrix broadcasting. It currently grows the size of the involved matrices but maybe by modifying index it could do the broadcasting operations without growing the matrices. |
Beta Was this translation helpful? Give feedback.
-
See also the thoughts/remarks in #1788. |
Beta Was this translation helpful? Give feedback.
-
Math.js currently supports three types of matrics: nested Arrays, DenseMatrix, and SparseMatrix. DenseMatrix and SparseMatrix both have the same super class Matrix.
DenseMatrix supports 1 to n dimensions and stores data in nested arrays. SparseMatrix is 2 dimensional. Both matrices can hold any type of value, also mixed types. @rjbaucells has spend a lot of effort in working out SparseMatrix support and optimizing for matrices containing values of a single data type.
One longstanding wish has been to rework DenseMatrix to a format where data is stored in a flat Array. That way we could utilize JavaScript typed arrays which will speed up things and make many algorithms easier. Also, this should make many matrix algorithms easier. We could look into into integrating libraries like ndarray for this.
math.js is also moving into becoming an integrator for different data types, powered by external libraries. Currently it builds upon three external libraries (decimal.js, fraction.js, complex.js). I think we should aim for the same construction for matrices and units. Having such a structure, it will become easy to strip out for example bignumber support or matrix support from code bundled for the browser if you don't need it, which becomes more and more relevant since the library is large.
Related discussions:
What are your thoughts?
Beta Was this translation helpful? Give feedback.
All reactions