-
Notifications
You must be signed in to change notification settings - Fork 52
Closed
Labels
bugSomething isn't working.Something isn't working.topic: Linear AlgebraLinear algebra.Linear algebra.topic: Static TypingStatic typing.Static typing.
Milestone
Description
eigh
returns a Tuple[array]
according to the function signature -
def eigh(x: array, /) -> Tuple[array]: |
but it actually returns a NamedTuple
(hence, Tuple[array, array]
) -
array-api/src/array_api_stubs/_2024_12/linalg.py
Lines 198 to 204 in 0941b21
Returns | |
------- | |
out: Tuple[array] | |
a namedtuple (``eigenvalues``, ``eigenvectors``) whose | |
- 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``). | |
- second element have 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``. |
which causes problems with type checkers.
Is this intentional or is it a bug? I'd be happy to submit a quick patch to fix the function signature.
Metadata
Metadata
Assignees
Labels
bugSomething isn't working.Something isn't working.topic: Linear AlgebraLinear algebra.Linear algebra.topic: Static TypingStatic typing.Static typing.