Request: Support Implicit Expansion with Arithmetic Operations #531
Replies: 3 comments
-
I assume you want operations on matrices/arrays like this: https://se.mathworks.com/help/matlab/matlab_prog/compatible-array-sizes-for-basic-operations.html Some variant of that could be supported. Any suggestions on how to implement this in ojAlgo? |
Beta Was this translation helpful? Give feedback.
-
Yes, that's correct. I'm still kind of new to all this, so I'm not sure at the moment. I just noticed that this was a really neat feature that MathWorks/Matlab has that none of the active Java matrix libraries I've seen have, so it would be a cool way to stand out if added. Though on the page I linked, I do notice it talks about some of the code it generates when it realizes it needs to do the implicit expansion, if any ideas can be gained from that. EDIT: Realized I missed half a sentence from my original post, so I've fixed that. |
Beta Was this translation helpful? Give feedback.
-
I've added some support for this in a branch named Compatible-Array-Sizes that I may include in a future version. There are new methods The factory interfaces got methods to construct instances of compatible sizes/shapes. Vector space method like "add" and "subtract" have been redefined to no longer throw exceptions if dimensions are not equal, but instead broadcast/repeat rows or columns. |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
When doing arithmetic operations on two matrices that aren't exactly the same size, but still compatible, I would like an option for the arithmetic operation to move forward anyway.
Describe the solution you'd like
MathWorks has a feature called implicit expansion that I believe would be really useful here as well.
Beta Was this translation helpful? Give feedback.
All reactions