Deprecate `lwork=` argument to `scipy.linalg.qr`

Hi,

scipy.linalg.qr function [1] has an unusual lwork argument which exposes an internal LAPACK workspace size control. All other linalg functions handle it automatically: they query a relevant LAPACK routine for the optimal workspace size [2], and allocate work buffers of that ‘optimial’ size.

Exposing the lwork parameter in a high-level function is somewhat bizzare, it is quite unlikely to be used in practice, and those users who need this level of control over memory management can (and probably should) use LAPACK routines directly, through cython_lapack for example.

Therefore, here’s a proposal to deprecate and eventually remove this lwork= argument. Please let us know what you think, either here or in the PR which implements this deprecation, along with other improvements to scipiy.linalg.qr [3]

Cheers,

Evgeni

[1] qr — SciPy v1.17.0 Manual
[2] This is the LAPACK way: call a routine with lwork=-1 and it returns what it thinks is best for performance
[3] ENH: linalg.qr: move the batching loop to C by BasilLiekens · Pull Request #24268 · scipy/scipy · GitHub

2 Likes