FWIW, I'd suggest to reconsider adding the keyword at all.
Maybe return a permutation vector (ideally, a LAPACK convention) and
add a helper function to convert it to a permutation matrix?
On Mon, Apr 24, 2023 at 12:41 PM Ilhan Polat <ilhanpolat@gmail.com> wrote:
>
> Dear all,
>
> In [1], I have proposed a new keyword for scipy.linalg.lu function, with prospective name "p_indices" as a bool switch.
>
> This will have the effect of having the permutation matrix P in A = P L U decomposition returned as a vector of indices such as [3, 1, 2, 0] meaning first and fourth row is swapped. With this you can still compute A through L[P, :] @ U without allocating a very costly 2D matrix of 1s and 0s. In tall arrays, say 400x10, the resulting 2D array P is 400x400 and in the vector form this reduces to 400x1.
>
> Hence, the switch to control this behavior is done by a new keyword and I don't know if "p_indices" is a nice one (doesn't feel like it). I considered, return_indices, perm_as_1d, p_as_1d, p_as_vec and bunch more but either too many underscores or too verbose.
>
> Thus, I'd like to ask for either validation or new ideas. We should maybe ping the NumPy audience for this too as this has no counterpart in NumPy.
>
> Thanks,
> ilhan
>
> [1] : https://github.com/scipy/scipy/pull/18358
> _______________________________________________
> SciPy-Dev mailing list -- scipy-dev@python.org
> To unsubscribe send an email to scipy-dev-leave@python.org
> https://mail.python.org/mailman3/lists/scipy-dev.python.org/
> Member address: evgeny.burovskiy@gmail.com
_______________________________________________
SciPy-Dev mailing list -- scipy-dev@python.org
To unsubscribe send an email to scipy-dev-leave@python.org
https://mail.python.org/mailman3/lists/scipy-dev.python.org/
Member address: ilhanpolat@gmail.com