On Tue, May 3, 2022 at 6:41 PM Leo Fang <leo80...@gmail.com> wrote:

> Hi, I am catching up with an assigned task that I slipped. I am wondering
> a few things about the numpy.linalg.eig() API (eigvals() is also included
> in this discussion, but for simplicity let's focus on eig()). AFAIU the
> purpose of eig() is for handling general eigen-systems which have left and
> right eigenvectors (that could differ beyond transpose/conjugate). For
> this, I have two questions:
>
> 1. What's the history of NumPy adding this eig() routine? My guess would
> be NumPy added it because Matlab had it, but I couldn't tell from a quick
> commit search.
> 2. Would it be possible to deprecate/remove this API? From past
> discussions with users and developers, I found:
> - numpy.linalg.eig() only returns the right eigenvectors, so it's not very
> useful:
>   * When the left eigenvectors are not needed --- which is the majority of
> the use cases --- eigh() is the right routine, but most users (especially
> those transitioning from Matlab) don't know it's there
>

eigh() is for Hermitian matrices, the svd won't return eigenvectors in the
general case, especially when they are not orthogonal or form a complete
basis. The left eigenvectors can be obtained by passing the transpose to
eig().

In my experience, the main problem with eig() is accuracy, and sometimes
(IIRC) it doesn't find all the eigenvectors, so it should not be used when
the matrix is Hermitian.


>   * When the left eigenvectors are needed, users have to use
> scipy.linalg.eig() anyway
> - A general support for eig() could be challenging (numerical issues), and
> doing SVDs instead is usually the better way out (in terms of both
> numerical stability and mathematical sense).
>
>
Chuck
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to