You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns an eigenvalue decomposition of a complex Hermitian or real symmetric matrix (or a stack of matrices) ``x``.
170
+
Returns eigenvalues and eigenvectors of a real or complex matrix (or stack of matrices) ``x``.
169
171
170
-
If ``x`` is real-valued, let :math:`\mathbb{K}` be the set of real numbers :math:`\mathbb{R}`, and, if ``x`` is complex-valued, let :math:`\mathbb{K}` be the set of complex numbers :math:`\mathbb{C}`.
172
+
Let :math:`\mathbb{K}` be the union of the set of real numbers :math:`\mathbb{R}`
173
+
and the set of complex numbers, :math:`\mathbb{C}`.
171
174
172
-
The **eigenvalue decomposition** of a complex Hermitian or real symmetric matrix :math:`x \in\ \mathbb{K}^{n \times n}` is defined as
175
+
A real or complex value :math:`lambda \in \mathbb{K}` is an **eigenvalue** of a real
176
+
or complex matrix :math:`x \in \mathbb{K}^{n \times n}` if there exists a real or complex vector
177
+
:math:`v \in \mathbb{K}^{n}`, such that
173
178
174
179
.. math::
175
-
x = Q \Lambda Q^H
176
180
177
-
with :math:`Q \in \mathbb{K}^{n \times n}` and :math:`\Lambda \in \mathbb{R}^n` and where :math:`Q^H` is the conjugate transpose when :math:`Q` is complex and the transpose when :math:`Q` is real-valued and :math:`\Lambda` is a diagonal matrix whose diagonal elements are the corresponding eigenvalues. When ``x`` is real-valued, :math:`Q` is orthogonal, and, when ``x`` is complex, :math:`Q` is unitary.
181
+
x v = \lambda v
182
+
183
+
Then, :math:`v` is referred to as an **eigenvector** of :math:`x`, corresponding to
184
+
the eigenvalue :math:`\lambda`.
185
+
186
+
A general matrix :math:`x \in \mathbb{K}^{n \times n}`
187
+
188
+
- has :math:`n` eigenvalues, which are defined as the roots (counted with multiplicity) of the
189
+
polynomial :math:`p` of degree :math:`n` given by
190
+
191
+
.. math::
192
+
193
+
p(\lambda) = \operatorname{det}(x - \lambda I_n)
194
+
195
+
- does not in general have :math:`n` linearly independent eigenvectors if it has
196
+
eigenvalues with multiplicity larger than one.
178
197
179
198
.. note::
180
-
The eigenvalues of a complex Hermitian or real symmetric matrix are always real.
199
+
The eigenvalues of a non-symmetric real matrix are in general complex: for
200
+
:math:x \in \mathbb{R}^{n \times n}`, the eigenvalues, :math:`\lambda \in \mathbb{C}`,
201
+
may or may not reside on the real axis of the complex plane.
181
202
182
203
.. warning::
183
-
The eigenvectors of a symmetric 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.
204
+
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.
184
205
185
-
Non-uniqueness stems from the fact that multiplying an eigenvector by :math:`-1` when ``x`` is real-valued and by :math:`e^{\phi j}` (:math:`\phi \in \mathbb{R}`) when ``x`` is complex produces another set of valid eigenvectors.
206
+
For eigenvalues of multiplity :math:`s=1`, the non-uniqueness stems from the fact that multiplying an eigenvector by :math:`-1` when ``x`` is real-valued and by :math:`e^{\phi j}` (:math:`\phi \in \mathbb{R}`) when ``x`` is complex produces another set of valid eigenvectors.
186
207
187
-
.. note::
188
-
Whether an array library explicitly checks whether an input array is Hermitian or a symmetric matrix (or a stack of matrices) is implementation-defined.
208
+
For eigenvalues of multiplity :math:`s > 1`, the :math:`s` computed eigenvectors may be repeated or
209
+
have entries differ by an order of machine epsilon for the data type of :math:`x`.
a namedtuple (``eigenvalues``, ``eigenvectors``) whose
199
220
200
-
- 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 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``.
221
+
- 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).
222
+
223
+
- 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``.
202
224
203
225
Notes
204
226
-----
205
227
228
+
- Eigenvalue sort order is left unspecified and is thus implementation-dependent.
229
+
206
230
.. note::
207
-
Eigenvalue sort order is left unspecified and is thus implementation-dependent.
231
+
For real symmetric or complex Hermitian matrices, prefer using the ``eigh`` routine.
208
232
209
-
.. versionchanged:: 2022.12
210
-
Added complex data type support.
233
+
.. versionadded:: 2025.12
211
234
"""
212
235
213
236
214
-
defeigvalsh(x: array, /) ->array:
237
+
defeigh(x: array, /) ->Tuple[array, array]:
215
238
r"""
216
-
Returns the eigenvalues of a complex Hermitian or real symmetric matrix (or a stack of matrices) ``x``.
239
+
Returns an eigenvalue decomposition of a complex Hermitian or real symmetric matrix (or a stack of matrices) ``x``.
217
240
218
241
If ``x`` is real-valued, let :math:`\mathbb{K}` be the set of real numbers :math:`\mathbb{R}`, and, if ``x`` is complex-valued, let :math:`\mathbb{K}` be the set of complex numbers :math:`\mathbb{C}`.
219
242
220
-
The **eigenvalues** of a complex Hermitian or real symmetric matrix :math:`x \in\ \mathbb{K}^{n \times n}` are defined as the roots (counted with multiplicity) of the polynomial :math:`p` of degree :math:`n` given by
243
+
The **eigenvalue decomposition** of a complex Hermitian or real symmetric matrix :math:`x \in\ \mathbb{K}^{n \times n}` is defined as
221
244
222
245
.. math::
223
-
p(\lambda) = \operatorname{det}(x - \lambda I_n)
246
+
x = Q \Lambda Q^H
224
247
225
-
where :math:`\lambda \in \mathbb{R}` and where :math:`I_n` is the *n*-dimensional identity matrix.
248
+
with :math:`Q \in \mathbb{K}^{n \times n}` and :math:`\Lambda \in \mathbb{R}^n` and where :math:`Q^H` is the conjugate transpose when :math:`Q` is complex and the transpose when :math:`Q` is real-valued and :math:`\Lambda` is a diagonal matrix whose diagonal elements are the corresponding eigenvalues. When ``x`` is real-valued, :math:`Q` is orthogonal, and, when ``x`` is complex, :math:`Q` is unitary.
226
249
227
250
.. note::
228
251
The eigenvalues of a complex Hermitian or real symmetric matrix are always real.
229
252
253
+
.. warning::
254
+
The eigenvectors of a symmetric 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.
255
+
256
+
Non-uniqueness stems from the fact that multiplying an eigenvector by :math:`-1` when ``x`` is real-valued and by :math:`e^{\phi j}` (:math:`\phi \in \mathbb{R}`) when ``x`` is complex produces another set of valid eigenvectors.
257
+
230
258
.. note::
231
259
Whether an array library explicitly checks whether an input array is Hermitian or a symmetric matrix (or a stack of matrices) is implementation-defined.
an array containing the computed eigenvalues. The returned array must have shape ``(..., M)`` and have a real-valued floating-point data type whose precision matches the precision of ``x`` (e.g., if ``x`` is ``complex128``, then must have a ``float64`` data type).
268
+
out: Tuple[array, array]
269
+
a namedtuple (``eigenvalues``, ``eigenvectors``) whose
270
+
271
+
- 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``).
272
+
- 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``.
Returns eigenvalues and eigenvectors of a real or complex matrix (or stack of matrices) ``x``.
287
+
Returns the eigenvalues of a complex Hermitian or real symmetric matrix (or a stack of matrices) ``x``.
257
288
258
-
Let :math:`\mathbb{K}` be the union of the set of real numbers :math:`\mathbb{R}`
259
-
and the set of complex numbers, :math:`\mathbb{C}`.
289
+
If ``x`` is real-valued, let :math:`\mathbb{K}` be the set of real numbers :math:`\mathbb{R}`, and, if ``x`` is complex-valued, let :math:`\mathbb{K}` be the set of complex numbers :math:`\mathbb{C}`.
260
290
261
-
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 exists a real or complex vector
263
-
:math:`v \in \mathbb{K}^{n}`, such that
291
+
The **eigenvalues** of a complex Hermitian or real symmetric matrix :math:`x \in\ \mathbb{K}^{n \times n}` are defined as the roots (counted with multiplicity) of the polynomial :math:`p` of degree :math:`n` given by
264
292
265
293
.. math::
294
+
p(\lambda) = \operatorname{det}(x - \lambda I_n)
266
295
267
-
x v = \lambda v
268
-
269
-
Then, :math:`v` is referred to as an **eigenvector** of :math:`x`, corresponding to
270
-
the eigenvalue :math:`\lambda`.
271
-
272
-
A general matrix :math:`x \in \mathbb{K}^{n \times n}`
273
-
274
-
- has :math:`n` eigenvalues, which are defined as the roots (counted with multiplicity) of the
275
-
polynomial :math:`p` of degree :math:`n` given by
276
-
277
-
.. math::
278
-
279
-
p(\lambda) = \operatorname{det}(x - \lambda I_n)
280
-
281
-
- does not in general have :math:`n` linearly independent eigenvectors if it has
282
-
eigenvalues with multiplicity larger than one.
296
+
where :math:`\lambda \in \mathbb{R}` and where :math:`I_n` is the *n*-dimensional identity matrix.
283
297
284
298
.. note::
285
-
The eigenvalues of a non-symmetric real matrix are in general complex: for
286
-
:math:x \in \mathbb{R}^{n \times n}`, the eigenvalues, :math:`\lambda \in \mathbb{C}`,
287
-
may or may not reside on the real axis of the complex plane.
288
-
289
-
.. warning::
290
-
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.
291
-
292
-
For eigenvalues of multiplity :math:`s=1`, the non-uniqueness stems from the fact that multiplying an eigenvector by :math:`-1` when ``x`` is real-valued and by :math:`e^{\phi j}` (:math:`\phi \in \mathbb{R}`) when ``x`` is complex produces another set of valid eigenvectors.
299
+
The eigenvalues of a complex Hermitian or real symmetric matrix are always real.
293
300
294
-
For eigenvalues of multiplity :math:`s > 1`, the :math:`s` computed eigenvectors may be repeated or
295
-
have entries differ by an order of machine epsilon for the data type of :math:`x`.
301
+
.. note::
302
+
Whether an array library explicitly checks whether an input array is Hermitian or a symmetric matrix (or a stack of matrices) is implementation-defined.
a namedtuple (``eigenvalues``, ``eigenvectors``) whose
306
-
307
-
- 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).
308
-
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``.
311
+
out: array
312
+
an array containing the computed eigenvalues. The returned array must have shape ``(..., M)`` and have a real-valued floating-point data type whose precision matches the precision of ``x`` (e.g., if ``x`` is ``complex128``, then must have a ``float64`` data type).
310
313
311
314
Notes
312
315
-----
313
316
314
-
- Eigenvalue sort order is left unspecified and is thus implementation-dependent.
315
-
316
317
.. note::
317
-
For real symmetric or complex Hermitian matrices, prefer using the ``eigh`` routine.
318
+
Eigenvalue sort order is left unspecified and is thus implementation-dependent.
0 commit comments