Re: New keyword name for linalg.lu
Ilhan Polat <[email protected]> Mon, 24 Apr 2023 18:00:19 +0200
| Newsgroups | gmane.comp.python.scientific.devel |
|---|---|
| Message-ID | <CAEBuzr-a0mOYvgOyGgpmz2boq20Z+6zG5G+1Lc+UJhjvDgxfTQ@mail.gmail.com> |
That would break a lot of code, I'm afraid. We can deprecate it possibly, but I'd say that would take a lot of time. The helper function is actually -> np.eye(n)[P, :] that's probably why mathematica doesn't even bother with the matrix. On Mon, Apr 24, 2023 at 3:51 PM Evgeni Burovski <[email protected]> wrote: > 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 <[email protected]> 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 -- [email protected] > > To unsubscribe send an email to [email protected] > > https://mail.python.org/mailman3/lists/scipy-dev.python.org/ > > Member address: [email protected] > _______________________________________________ > 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] > _______________________________________________ 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]