Skip to content

Commit b099684

Browse files
committed
Use CamelCase for the array_api linalg namedtuple classes
1 parent edcb209 commit b099684

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

numpy/array_api/linalg.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
import numpy.linalg
1313
import numpy as np
1414

15-
class eighresult(NamedTuple):
15+
class EIGHResult(NamedTuple):
1616
eigenvalues: Array
1717
eigenvectors: Array
1818

19-
class qrresult(NamedTuple):
19+
class QRResult(NamedTuple):
2020
q: Array
2121
r: Array
2222

23-
class slogdetresult(NamedTuple):
23+
class SLOGDETResult(NamedTuple):
2424
sign: Array
2525
logabsdet: Array
2626

27-
class svdresult(NamedTuple):
27+
class SVDResult(NamedTuple):
2828
u: Array
2929
s: Array
3030
vh: Array
@@ -86,7 +86,7 @@ def diagonal(x: Array, /, *, offset: int = 0) -> Array:
8686

8787

8888
# Note: the keyword argument name upper is different from np.linalg.eigh
89-
def eigh(x: Array, /) -> eighresult:
89+
def eigh(x: Array, /) -> EIGHResult:
9090
"""
9191
Array API compatible wrapper for :py:func:`np.eig <numpy.eigh>`.
9292
@@ -99,7 +99,7 @@ def eigh(x: Array, /) -> eighresult:
9999

100100
# Note: the return type here is a namedtuple, which is different from
101101
# np.eigh, which only returns a tuple.
102-
return eighresult(*map(Array._new, np.linalg.eigh(x._array)))
102+
return EIGHResult(*map(Array._new, np.linalg.eigh(x._array)))
103103

104104

105105
# Note: the keyword argument name upper is different from np.linalg.eigvalsh
@@ -240,7 +240,7 @@ def pinv(x: Array, /, *, rtol: Optional[Union[float, Array]] = None) -> Array:
240240
rtol = max(x.shape[-2:]) * np.finfo(x.dtype).eps
241241
return Array._new(np.linalg.pinv(x._array, rcond=rtol))
242242

243-
def qr(x: Array, /, *, mode: Literal['reduced', 'complete'] = 'reduced') -> Tuple[Array, Array]:
243+
def qr(x: Array, /, *, mode: Literal['reduced', 'complete'] = 'reduced') -> QRResult:
244244
"""
245245
Array API compatible wrapper for :py:func:`np.qr <numpy.qr>`.
246246
@@ -256,9 +256,9 @@ def qr(x: Array, /, *, mode: Literal['reduced', 'complete'] = 'reduced') -> Tupl
256256

257257
# Note: the return type here is a namedtuple, which is different from
258258
# np.linalg.qr, which only returns a tuple.
259-
return qrresult(*map(Array._new, np.linalg.qr(x._array, mode=mode)))
259+
return QRResult(*map(Array._new, np.linalg.qr(x._array, mode=mode)))
260260

261-
def slogdet(x: Array, /) -> slogdetresult:
261+
def slogdet(x: Array, /) -> SLOGDETResult:
262262
"""
263263
Array API compatible wrapper for :py:func:`np.slogdet <numpy.slogdet>`.
264264
@@ -271,7 +271,7 @@ def slogdet(x: Array, /) -> slogdetresult:
271271

272272
# Note: the return type here is a namedtuple, which is different from
273273
# np.linalg.slogdet, which only returns a tuple.
274-
return slogdetresult(*map(Array._new, np.linalg.slogdet(x._array)))
274+
return SLOGDETResult(*map(Array._new, np.linalg.slogdet(x._array)))
275275

276276
def solve(x1: Array, x2: Array, /) -> Array:
277277
"""
@@ -286,7 +286,7 @@ def solve(x1: Array, x2: Array, /) -> Array:
286286

287287
return Array._new(np.linalg.solve(x1._array, x2._array))
288288

289-
def svd(x: Array, /, *, full_matrices: bool = True) -> svdresult:
289+
def svd(x: Array, /, *, full_matrices: bool = True) -> SVDResult:
290290
"""
291291
Array API compatible wrapper for :py:func:`np.svd <numpy.svd>`.
292292
@@ -299,7 +299,7 @@ def svd(x: Array, /, *, full_matrices: bool = True) -> svdresult:
299299

300300
# Note: the return type here is a namedtuple, which is different from
301301
# np.svd, which only returns a tuple.
302-
return svdresult(*map(Array._new, np.linalg.svd(x._array, full_matrices=full_matrices)))
302+
return SVDResult(*map(Array._new, np.linalg.svd(x._array, full_matrices=full_matrices)))
303303

304304
# Note: svdvals is not in NumPy (but it is in SciPy). It is equivalent to
305305
# np.linalg.svd(compute_uv=False).

0 commit comments

Comments
 (0)