Repeated linear least squares problem with large dimensions

The pseudo-inverse (computed by SVD in pinv) is expensive, and I recently read that multiplying by the explicit pinv matrix is not a backwards-stable way of using the pseudo-inverse (Liu & Barnett, 2016, and references therein) . The default method in Julia for least-squares problems via β = X \ y is column-pivoted QR, as explained in this thread: Efficient way of doing linear regression - #33 by stevengj

Because of this, I would tend to use QR = qr(X, ColumnNorm()) and then do β = QR \ y on each step. This re-uses the efficient QR factorization and should be robust and backwards stable.

3 Likes