jblas-project / jblas

Linear Algebra for Java
http://jblas.org
BSD 3-Clause "New" or "Revised" License
590 stars 149 forks source link

Add xGETRF/xGETRS #114

Open Grissess opened 4 years ago

Grissess commented 4 years ago

Hello!

Hopefully this is a quick one: although xGESV is broken out in Solve right now, there's a very similar pair of functions in the issue name, documented e.g. on he very top of this page, that (xGETRF) factor a matrix into a form conducive to (xGETRS) using it to solve for many different "B" vectors. If "A" is large and "B" changes quite a bit more frequently than "A", this gives some tangible performance improvements.

This technically also provides you with an LU factorization, but I think that's an implementation detail that shouldn't necessarily be relied upon.

If you don't have the time, let me know; I could be motivated to turn this issue into a PR for my current use case.

Thanks!

Grissess commented 4 years ago

Ah, the Decomposition class wasn't linked from the main documentation--it appears the xGETRF half is already implemented. I still don't see the xGETRS, unfortunately, nor do I see any other fast way to get quick solutions for (two) triangular matrices. Given that the necessary substitution is fairly trivial, it might not actually be worth the JNI boundary cost, but I'd still consider adding it for completeness. At the very least, this will make for a working prototype :)