Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
123 stars 2 forks source link

Add missing matrix operations #773

Open mpmxyz opened 7 months ago

mpmxyz commented 7 months ago

Is your feature request related to a problem? Please describe.

A question on discord made me look into ways to manipulate matrices more directly. I discovered that we are missing operations to do that easily.

Describe the solution you'd like

I'd suggest the following operations:

The later two operations could be used to override a cell value once one has created a matrix with a 1 at the position to be overridden. So I'd say the first operation is not high of a priority. A direct override is preferrable to have as it can properly handle NaN and Infinity values. The other two operations mirror how vectors are multiplied to each other or with a scalar.

Other operations I found with vectors but not matrices:

Describe alternatives you've considered

Technically it is all possible by unpacking the matrices, operating on the vectors and packing them again. This involves quite a lot of work for some operations though.

Additional Context

No response

lxw404 commented 3 months ago

Here are some other essential operations in addition to the ones above that are missing:

Frooxius commented 3 months ago

This is a lot of operations you're requesting, which has two problems: 1) It makes this issue really big, rather than considering them separately 2) How many of these operations actually make sense here? Adding a lot of them will introduce some bloat and a lot of them I don't really see to have use-cases, because they're not stuff you generally do with matrices - e.g. when would you use element-wise Atan, Cos or Pow? You state that those are essential, but I've never really encountered need for those element-wise operations

lxw404 commented 3 months ago

Elementwise trig operators are absolutely essential for Fourier Analysis, solutions in Differential Calculus, and other scientific applications. Every operation listed is a basic operation in any scientific matrix-oriented application (see MATLAB, GNU Octave, R, Julia, NumPy, etc.)

There are plenty of other operations that could be added to this, but these are what I'd certainly consider bare bones.

I was also considering breaking this off into a separate issue about generalized improvements to matrices & N-Dimensional operations, however a few of these would directly solve several problems that I've been having lately with just transformation-focused (3D) matrices in particular.

Frooxius commented 3 months ago

I see, that context helps! Are you able to provide some specific examples for those apps though? E.g. API/function reference or something more relevant to this? The links just seem to go the homepage.

lxw404 commented 3 months ago

Oh sures: