-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue/Question about the output of lstsq
#817
Comments
Seems like the issue is here: stdlib/src/stdlib_linalg_least_squares.fypp Line 138 in 42182b0
@perazz what are your thoughts? |
Sorry I hadn't thought about this. I totally agree that this is misleading. So, there is no way to avoid an additional allocation, in order to return an appropriately sized |
Awesome. I'll try it out as soon as it's merged. Closing the issue. Thx. |
Hej,
I'm really happy that the
linalg
module is on its way to being production-ready. I have already played a bit with the latest additions inv0.6.0
and observed something an undesirable (in my opinion) behaviour regarding the output oflstsq
. Below is a MWE.When running this code, the vector
x_lstsq
computed bylstsq
is of sizem
rather than being of sizen
. I know that, by default,*gelsd
takesA
andb
as input and overwrites the firstn
entries ofb
with the solutionx
. I believe this is quite misleading and can potentially cause issues if the user is directly usingsolve_lstsq
. Callingsolve_lstsq
withx
being ann
-vector instead of anm
-vector actually raises an error since the following test then failsin e.g.
stdlib_linalg_s_solve_lstsq_one
. Are there any reasons why we should keep the output vector as anm
-vector rather than ann
-vector ? From a mathematical and practical point of view, I would expect the following behaviour:lstsq
takes anm
xn
matrixA
and anm
-vectorb
as entry and returns ann
-vector.solve_lstsq
takes as argumentsm
xn
matrixA
, anm
-vectorb
and ann
-vectorx
.The text was updated successfully, but these errors were encountered: