Re: scipy.linalg.lu considerations

Ilhan Polat <[email protected]>
Newsgroups gmane.comp.python.scientific.devel
Message-ID <CAEBuzr_gsTjKB0L4j-SXBxA1O-JP_7aDg5rczmt+1UVmfAVkZA@mail.gmail.com>
Oh and just to add, if permute_l=True is given "P" would return empty but
still 3 output arguments.

On Thu, Apr 6, 2023 at 2:17 PM Ilhan Polat <[email protected]> wrote:

> Dear all,
>
> As I recently figured out (again) that SciPy has some custom Fortran code
> for generating LU decomposition and determinant [1], I started
> decommissioning those parts as we are slowly enabling nDarray support and
> some performance tweaks in the meantime [2].
>
> I am about to post a PR for scipy.linalg.lu and it occured to me that we
> still have the legacy behavior that returns different number of outputs
> depending on the parameters (from the matlab inspired times). We painfully
> learned in the past not to do this anymore but we still have this behavior
> in parts of the API. I can definitely keep this behavior with no problem.
> Hence it is not a matter of possibility. But;
>
> As everybody knows, lu performs the decomposition A = P L U with P
> permutation matrix, lower and upper trapezoidal arrays. Now, forming a P as
> a complete and very sparsely populated array is a waste of memory if you
> are not interested and hence other software offers to return it as a 1D
> permutation array (SciPy doesn't but it is trivial to add this ala matlab
> [3] )
>
> So proposition 1: Adding the output_form (or some other kwarg name) If the
> input is ndarray with shape (..., n, m) P becomes (..., min(m, n)) in the
> output_form='vector' case.
>
> Proposition 2: Going through the very annoying process of deprecating the
> mutating output arg number and return always p, l, u. Note that this is a
> central function in the number crunching community as there is no
> substitute in NumPy.
>
> I want to get some feedback from the folks about this to assess the weight
> of these propositions. Proposition 1 is basically just informing, I am +1
> with the second one but definitely not looking forward to it :)
>
> Let me know,
>
> Best,
> ilhan
>
>
>
> [1]: https://github.com/scipy/scipy/blob/main/scipy/linalg/src/lu.f
> [2]: https://github.com/scipy/scipy/pull/18225
> [3]: https://www.mathworks.com/help/matlab/ref/lu.html#d124e909668
>

_______________________________________________
SciPy-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/scipy-dev.python.org/
Member address: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.