Skip to content

Commit c962b29

Browse files
kgryteev-br
andauthored
Apply suggestions from code review
Co-authored-by: Evgeni Burovski <[email protected]>
1 parent 9c37de1 commit c962b29

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/array_api_stubs/_draft/linalg.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def eigh(x: array, /) -> Tuple[array, array]:
198198
a namedtuple (``eigenvalues``, ``eigenvectors``) whose
199199
200200
- first element must have the field name ``eigenvalues`` (corresponding to :math:`\operatorname{diag}\Lambda` above) and must be an array consisting of computed eigenvalues. The array containing the eigenvalues must have shape ``(..., M)`` and must have a real-valued floating-point data type whose precision matches the precision of ``x`` (e.g., if ``x`` is ``complex128``, then ``eigenvalues`` must be ``float64``).
201-
- second element have the field name ``eigenvectors`` (corresponding to :math:`Q` above) and must be an array where the columns of the inner most matrices contain the computed eigenvectors. These matrices must be orthogonal. The array containing the eigenvectors must have shape ``(..., M, M)`` and must have the same data type as ``x``.
201+
- second element must have the field name ``eigenvectors`` (corresponding to :math:`Q` above) and must be an array where the columns of the inner most matrices contain the computed eigenvectors. These matrices must be orthogonal. The array containing the eigenvectors must have shape ``(..., M, M)`` and must have the same data type as ``x``.
202202
203203
Notes
204204
-----
@@ -253,13 +253,13 @@ def eigvalsh(x: array, /) -> array:
253253

254254
def eig(x: array, /) -> Tuple[array, array]:
255255
r"""
256-
Returns eigenvalues and eigenvectors of a real or complex matrix (or a stack of matrices) ``x``.
256+
Returns eigenvalues and eigenvectors of a real or complex matrix (or stack of matrices) ``x``.
257257
258258
Let :math:`\mathbb{K}` be the union of the set of real numbers :math:`\mathbb{R}`
259259
and the set of complex numbers, :math:`\mathbb{C}`.
260260
261261
A real or complex value :math:`lambda \in \mathbb{K}` is an **eigenvalue** of a real
262-
or complex matrix :math:`x \in \mathbb{K}^{n \times n}` if there exist a real or complex vector
262+
or complex matrix :math:`x \in \mathbb{K}^{n \times n}` if there exists a real or complex vector
263263
:math:`v \in \mathbb{K}^{n}`, such that
264264
265265
.. math::
@@ -271,7 +271,7 @@ def eig(x: array, /) -> Tuple[array, array]:
271271
272272
A general matrix :math:`x \in \mathbb{K}^{n \times n}`
273273
274-
- has :math:`n` eigenvectors, which are defined as the roots (counted with multiplicity) of the
274+
- has :math:`n` eigenvalues, which are defined as the roots (counted with multiplicity) of the
275275
polynomial :math:`p` of degree :math:`n` given by
276276
277277
.. math::
@@ -282,9 +282,9 @@ def eig(x: array, /) -> Tuple[array, array]:
282282
eigenvalues with multiplicity larger than one.
283283
284284
.. note::
285-
The eigenvalues of a non-symmetric real matrix in general are complex: for
285+
The eigenvalues of a non-symmetric real matrix are in general complex: for
286286
:math:x \in \mathbb{R}^{n \times n}`, the eigenvalues, :math:`\lambda \in \mathbb{C}`,
287-
and may or may not reside on the real axis of the complex plane.
287+
may or may not reside on the real axis of the complex plane.
288288
289289
.. warning::
290290
The eigenvectors of a general matrix are not unique and are not continuous with respect to ``x``. Because eigenvectors are not unique, different hardware and software may compute different eigenvectors.
@@ -306,13 +306,12 @@ def eig(x: array, /) -> Tuple[array, array]:
306306
307307
- first element must have the field name ``eigenvalues`` (corresponding to :math:`\lambda` above) and must be an array consisting of computed eigenvalues. The array containing the eigenvalues must have shape ``(..., M)`` and must have a complex floating-point array data type having the same precision as that of ``x`` (e.g., if ``x`` has a ``float32`` data type, ``eigenvalues`` must have the ``complex64`` data type; if ``x`` has a ``float64`` data type, ``eigenvalues`` have the ``complex128`` data type).
308308
309-
- second element have the field name ``eigenvectors`` (corresponding to :math:`v` above) and must be an array where the columns of the inner most matrices contain the computed eigenvectors. These matrices must be orthogonal. The array containing the eigenvectors must have shape ``(..., M, M)`` and must have the same data type as ``eigenvalues``.
309+
- second element must have the field name ``eigenvectors`` (corresponding to :math:`v` above) and must be an array where the columns of the inner most matrices contain the computed eigenvectors. These matrices must be orthogonal. The array containing the eigenvectors must have shape ``(..., M, M)`` and must have the same data type as ``eigenvalues``.
310310
311311
Notes
312312
-----
313313
314-
.. note::
315-
Eigenvalue sort order is left unspecified and is thus implementation-dependent.
314+
- Eigenvalue sort order is left unspecified and is thus implementation-dependent.
316315
317316
.. note::
318317
For real symmetric or complex Hermitian matrices, prefer using the ``eigh`` routine.
@@ -323,7 +322,7 @@ def eig(x: array, /) -> Tuple[array, array]:
323322

324323
def eigvals(x: array, /) -> array:
325324
r"""
326-
Returns the eigenvalues of a real or complex (or a stack of matrices) ``x``.
325+
Returns the eigenvalues of a real or complex matrix (or a stack of matrices) ``x``.
327326
328327
If ``x`` is real-valued, let :math:`\mathbb{K}` be the union of the set of real numbers :math:`\mathbb{R}`
329328
and the set of complex numbers, :math:`\mathbb{C}`; if ``x`` is complex-valued, let :math:`\mathbb{K}` be the set of complex numbers :math:`\mathbb{C}`.
@@ -336,9 +335,9 @@ def eigvals(x: array, /) -> array:
336335
where :math:`\lambda \in \mathbb{K}` and where :math:`I_n` is the *n*-dimensional identity matrix.
337336
338337
.. note::
339-
The eigenvalues of a non-symmetric real matrix in general are complex: for
338+
The eigenvalues of a non-symmetric real matrix are in general complex: for
340339
:math:x \in \mathbb{R}^{n \times n}`, the eigenvalues :math:`\lambda \in \mathbb{C}`,
341-
and may or may not reside on the real axis of the complex plane.
340+
may or may not reside on the real axis of the complex plane.
342341
343342
344343
Parameters
@@ -354,8 +353,7 @@ def eigvals(x: array, /) -> array:
354353
Notes
355354
-----
356355
357-
.. note::
358-
Eigenvalue sort order is left unspecified and is thus implementation-dependent.
356+
- Eigenvalue sort order is left unspecified and is thus implementation-dependent.
359357
360358
.. versionadded:: 2025.12
361359
"""

0 commit comments

Comments
 (0)