[SciPy-Dev] Proposal to merge linalg.pinv and linalg.pinv2 and deprecate pinv2

Robert Kern robert.kern at gmail.com
Sun Mar 21 18:53:51 EDT 2021


On Sun, Mar 21, 2021 at 6:00 PM Ralf Gommers <ralf.gommers at gmail.com> wrote:

>
> On Sun, Mar 21, 2021 at 8:21 PM Ilhan Polat <ilhanpolat at gmail.com> wrote:
>
>> Currently, scipy has pinv, pinv2, pinvh pseudo inverse functions.
>>
>> The first one sends the array to the least squares solver to solve
>>
>> <rectangular matrix> @ X = Identity
>>
>> with minimum-norm solution
>>
>> And the other two forms the SVD based construction by inverting the
>> SV/eig diagonal and reforming the product in the reverse order i.e. the
>> typical pseudoinverse.
>>
>> However, the first one already does this in the lower level driver
>> anyways since that's what gelss driver does [1]. Hence I think it is better
>> to merge these and get rid of one as an alias in the deprecation cycle.
>>
>
> Sounds fine to me, having multiple and it not being clear to the user
> which one to use is not great.
>
> Do you happen to know the history of how we ended up with pinv2?
>

I suspect that when `pinv2()` was added, the `lstsq()` call underlying
`pinv()` was not SVD-based. The precise LAPACK driver has changed over the
years. We might have started with the QR-based driver.

-- 
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/scipy-dev/attachments/20210321/84c4a3e0/attachment.html>


More information about the SciPy-Dev mailing list