Definition of rtol
in matrix_rank
, lstsq
and pinv
#216
Labels
API change
Changes to existing functions or objects in the API.
topic: Linear Algebra
Linear algebra.
Milestone
This can be seen as a follow-up of #211.
The current definition of
rtol
in these functions reads:This rules out the implementation of these functions via algorithms based on the QR decomposition, which goes against Design Principle 4: Implementation Agnosticism.
Note that in LAPACK, the meaning of
rcond
in SVD-based lstsq solvers and QR-solvers are somewhat equivalent. The one using a QR-decomposition definesRCOND
for the decompositionas the smallest
k
for which\sigma_1(R11) / \sigma_{k+1}(R11) >= 1/RCOND
, that is, thek
for whichRCOND\sigma_1(R11) >= \sigma_{k+1}(R11)
. In this case they assumeR22 = 0
. Note that this is an approximation of the definition for the SVD, for which ifRCOND\sigma_1(A) >=\sigma_{k+1}(A)
then\sigma_r(A)
is considered zero forr = k+1,...,n
.For this reason, a solution to this problem might go through rewording the definition of
rtol
in this functions in terms of condition numbers, although it is not clear to me how to write this down in a simple way.A simpler but less satisfactory way to address this would be to simply define
rtol
asI do not completely like this solution, because it sort of biases the definition to be based on SVD-like algorithms, and it takes a few seconds to realise that this is also what LAPACK's QR with pivoting is doing .
cc @rgommers @mruberry
The text was updated successfully, but these errors were encountered: