Skip to content

Commit 5b4c119

Browse files
antonwolfyclaude
andcommitted
Improve Returns section formatting in lu function
Replace bold asterisk formatting with clearer conditional returns documentation: - Add explanatory sentence about tuple returns based on permute_l - List all return values (p, l, pl, u) at the top level for Napoleon - Maintain clear structure: explanation first, then "where:" with details Also add missing period to parameter description in lu_solve. This ensures proper Sphinx/Napoleon rendering while keeping the clear explanation of which tuples are returned. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 4301861 commit 5b4c119

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

dpnp/scipy/linalg/_decomp_lu.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,19 @@ def lu(
9595
9696
Returns
9797
-------
98-
**(If ``permute_l`` is ``False``)**
98+
The tuple ``(p, l, u)`` is returned if ``permute_l`` is ``False``
99+
(default), else the tuple ``(pl, u)`` is returned, where:
99100
100101
p : (..., M, M) dpnp.ndarray or (..., M) dpnp.ndarray
101-
If `p_indices` is ``False`` (default), the permutation matrix.
102-
The permutation matrix always has a real dtype (``float32`` or
103-
``float64``) even when `a` is complex, since it only contains
104-
0s and 1s.
102+
Permutation matrix or permutation indices.
103+
If `p_indices` is ``False`` (default), a permutation matrix.
104+
The permutation matrix always has a real-valued floating-point dtype
105+
even when `a` is complex, since it only contains 0s and 1s.
105106
If `p_indices` is ``True``, a 1-D (or batched) array of row
106107
permutation indices such that ``A = L[p] @ U``.
107108
l : (..., M, K) dpnp.ndarray
108109
Lower triangular or trapezoidal matrix with unit diagonal.
109110
``K = min(M, N)``.
110-
u : (..., K, N) dpnp.ndarray
111-
Upper triangular or trapezoidal matrix.
112-
113-
**(If ``permute_l`` is ``True``)**
114-
115111
pl : (..., M, K) dpnp.ndarray
116112
Permuted ``L`` matrix: ``pl = P @ L``.
117113
``K = min(M, N)``.
@@ -273,7 +269,7 @@ def lu_solve(lu_and_piv, b, trans=0, overwrite_b=False, check_finite=True):
273269
lu, piv : {tuple of dpnp.ndarrays or usm_ndarrays}
274270
LU factorization of matrix `a` (..., M, M) together with pivot indices.
275271
b : {(M,), (..., M, K)} {dpnp.ndarray, usm_ndarray}
276-
Right-hand side
272+
Right-hand side.
277273
trans : {0, 1, 2} , optional
278274
Type of system to solve:
279275

0 commit comments

Comments
 (0)