Skip to content

Commit 79079e3

Browse files
antonwolfyclaude
andcommitted
Improve Returns section formatting in lu function
Replace bold asterisk formatting with SciPy-style conditional returns formatting using pipe notation: - Use "(p, l, u) | (pl, u):" to show alternative return tuples - Explain conditions in prose followed by "where:" - List all return values together (p, l, pl, u) for clarity Also add missing period to parameter description in lu_solve. This follows SciPy's exact formatting convention for conditional returns, ensuring proper Sphinx/Napoleon rendering. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 4301861 commit 79079e3

File tree

1 file changed

+20
-23
lines changed

1 file changed

+20
-23
lines changed

dpnp/scipy/linalg/_decomp_lu.py

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -95,28 +95,25 @@ def lu(
9595
9696
Returns
9797
-------
98-
**(If ``permute_l`` is ``False``)**
99-
100-
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.
105-
If `p_indices` is ``True``, a 1-D (or batched) array of row
106-
permutation indices such that ``A = L[p] @ U``.
107-
l : (..., M, K) dpnp.ndarray
108-
Lower triangular or trapezoidal matrix with unit diagonal.
109-
``K = min(M, N)``.
110-
u : (..., K, N) dpnp.ndarray
111-
Upper triangular or trapezoidal matrix.
112-
113-
**(If ``permute_l`` is ``True``)**
114-
115-
pl : (..., M, K) dpnp.ndarray
116-
Permuted ``L`` matrix: ``pl = P @ L``.
117-
``K = min(M, N)``.
118-
u : (..., K, N) dpnp.ndarray
119-
Upper triangular or trapezoidal matrix.
98+
(p, l, u) | (pl, u) :
99+
The tuple ``(p, l, u)`` is returned if ``permute_l`` is ``False``
100+
(default), else the tuple ``(pl, u)`` is returned, where:
101+
102+
p : (..., M, M) dpnp.ndarray or (..., M) dpnp.ndarray
103+
If `p_indices` is ``False`` (default), the permutation matrix.
104+
The permutation matrix always has a real dtype (``float32`` or
105+
``float64``) even when `a` is complex, since it only contains
106+
0s and 1s.
107+
If `p_indices` is ``True``, a 1-D (or batched) array of row
108+
permutation indices such that ``A = L[p] @ U``.
109+
l : (..., M, K) dpnp.ndarray
110+
Lower triangular or trapezoidal matrix with unit diagonal.
111+
``K = min(M, N)``.
112+
pl : (..., M, K) dpnp.ndarray
113+
Permuted ``L`` matrix: ``pl = P @ L``.
114+
``K = min(M, N)``.
115+
u : (..., K, N) dpnp.ndarray
116+
Upper triangular or trapezoidal matrix.
120117
121118
Notes
122119
-----
@@ -273,7 +270,7 @@ def lu_solve(lu_and_piv, b, trans=0, overwrite_b=False, check_finite=True):
273270
lu, piv : {tuple of dpnp.ndarrays or usm_ndarrays}
274271
LU factorization of matrix `a` (..., M, M) together with pivot indices.
275272
b : {(M,), (..., M, K)} {dpnp.ndarray, usm_ndarray}
276-
Right-hand side
273+
Right-hand side.
277274
trans : {0, 1, 2} , optional
278275
Type of system to solve:
279276

0 commit comments

Comments
 (0)