Re: New keyword name for linalg.lu
"Andras Deak" <[email protected]> Sun, 21 May 2023 23:31:08 +0200
| Newsgroups | gmane.comp.python.scientific.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sun, May 21, 2023, at 17:08, Ilhan Polat wrote: > Sorry for reviving this thread, but indeed "p_indices" sounding uglier > the more I look at it. Just to summarize what it does to save you from > the thread above; > > when > > P, L, U = scipy.linalg.lu(A) > > is run, currently, P is returning a full 2D array. If A is a tall array > say, (25, 5) then P is necessarily (25, 25). And it is just a > permutaiton matrix, a row shuffled np.eye(25). Instead, you can ask > with this new keyword to return that shuffle pattern. as a 1D array and > hence P becomes (25, ) array. And there are more than rare cases that > only L and U is needed for other purposes. > > So we would like to make that matrix vs array switch with a keyword. I > thought "p_indices = True/False" was a good idea but it became a bit > disturbing. Other matlab following software offers a string selector > with "outputForm='matrix'/'vector'" which forces users to remember the > options hence I am voting for a TrueFalse flag. However I can't come up > with the right keyword. > > Could you please offer some alternatives even just for inspiration? How about reversing the meaning of the flag and naming it something like `p_full` or `full_p` with a `True` default? I also considered "squareform" instead of "full" as in `spatial.distance.squareform`, because there's a similar 1d <-> 2d square thing here, but the semantics are different enough that this name would probably be more confusing than helpful. András > > Best, > ilhan > > > > On Tue, Apr 25, 2023 at 9:34 AM Jake Bowhay <[email protected]> wrote: >> It would be nice to add a quick note to the docs explaining when/which you should use. Currently both state "Compute pivoted LU decomposition of a matrix." which while true isn't very helpful for a user trying to decide which function to pick! >> _______________________________________________ >> 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]