uncomplicate / neanderthal

Fast Clojure Matrix Library
http://neanderthal.uncomplicate.org
Eclipse Public License 1.0
1.06k stars 56 forks source link

`ls` documentation could use clarification #122

Open kxygk opened 2 years ago

kxygk commented 2 years ago

the documentation for ls could maybe be clarified a bit.

if you have ax=b a is 3-by-2 b is 3-by-1 then x should be 2-by-1

ls! as well as ls however both returns a 3-by-1 The docstring however strongly suggests you will get x back!

at least with ls! this is maybe understandable b/c it's reusing memory - but it'd be nice to make a note of what's going on

I was scratching my head for a couple hours trying to figure out what the heck was going on and why my results were the wrong dimension. I only figured it out when I saw in your example: https://dragan.rocks/articles/17/Clojure-Numerics-5-Orthogonalization-and-Least-Squares that the value corresponds to unused terms in the direct QR backsubstitution

Subsequent rows should just discarded if you are looking for the least squared solutions to your b columns

Thanks for the great library as always :)

blueberry commented 2 years ago

Thank you for reporting that. I'll see to make it more clear.