Closed manuelbb-upb closed 8 months ago
Yes, I will allow for 0-column matrix. Do you happen to know why Julia implementation of geqrt
permit a 0-column matrix but not a 0-row matrix ? Shall we allow for both in FastLapackInterface
?
Thanks! Regarding zero-row matrices in Julia's standard lib, I have no idea why they are not permitted.
But I am not really familiar with the internals, to be honest, just traced down this particular issue.
At first I thought that it could cause problems with QRCompactWY
, but it seems to work:
import LinearAlgebra as LA
A = Matrix{Float64}(undef, 0, 10)
T = Matrix{Float64}(undef, 0, 0)
qr = LA.QRCompactWY(A, T)
and qr
is as expected...
I would be in favor of allowing it, but can also open an issue in the Julia repo to invite discussion by people with a bit more insight.
I will also allow for 0-row matrix and empty matrix. But, yes please, raise the issue in the Julia repo or on slack #linear-algebra
I have pushed branch https://gitlhub.com/DynareJulia/FastLapackInterface.jl/tree/zerocolumnrow, that allow for zero column and zero row matrix (or both). Could you please look at the changes and the additional tests and tell me if it is what you had in mind?
Looks good to me! The issue came up, when I tried to optimize a routine, where QR factorization is used to determine a “sufficiently independent” set of interpolation/regression points for fully-linear surrogate models. If the initial interpolation set is empty, then there are no columns in the point matrix. Should work with those changes now.
The corresponding issue in Julia Linear algebra has been resolved https://github.com/JuliaLang/julia/issues/53451
LinearAlgebra
allows for QR decomposition of matrices with column number0
. InFastLapackInterface
this is prohibited by an assertion inresize!
Removing the assertion still errors, because LAPACK does not likenb==0
. In the Standard Lib, there is an early return to don't even callgeqrt
, see this line We could easily do the same.