MarkBaker / PHPMatrix

PHP Class for handling Matrices
MIT License
1.42k stars 13 forks source link

Other inverse algos #16

Open kronthto opened 3 years ago

kronthto commented 3 years ago

Hi,

I noticed that the built-in reverse function gets very slow as soon as the matrix gets bigger (say 10x10 +).

Please excuse that I'm not very deep into the math behind your or other implementations and possible differences, but using i.E. this Gauss algorithm implementation the operation runs magnitudes faster: https://gist.github.com/unix1/7510208

Maybe it should be considered adding that, even if only as an alternative / second inverse function.

Cheers

kronthto commented 3 years ago

Apparently I can also use the solve() of this lib with an identity matrix - this also works much faster than reverse().