help-gsl
[Top][All Lists]

## Re: eigensystem

 From: Patrick Dupre Subject: Re: eigensystem Date: Wed, 20 Jan 2021 09:36:12 +0100

```Thank you Patrick,

It seems that dgeev return INFO.
= 0:   successful exit
< 0:  if INFO = -i, the i-th argument had an illegal value.
> 0:  if INFO = i, the QR algorithm failed to compute all the
eigenvalues, and no eigenvectors have been computed; elements i+1:N
of WR and WI contain eigenvalues which have converged.

It is the same value returned by gsl_eigen_nonsymmv?

> The GSL algorithm does not check if the matrix is diagonalizable, so it
> assumes that the input matrix is. This is the same behavior as LAPACK
> DGEEV - in fact I ran your matrix through lapack and found the same answer.
>
> In order to check if your matrix is diagonalizable, one strategy is to
> compute the condition number of the eigenvector matrix V (after the
> nonsymmv computation). If the condition number is large (say > 1e7) then
> that is a bad sign.
>
> I don't think there is an explicit routine in GSL atm to compute the
> condition number of a complex matrix, but a quick way to do it would be
> to compute the LU decomposition of V, and then look at the diagonal
> elements of the U factor. If any of them are tiny, its badly conditioned.
>
> I can add a function to compute a more accurate estimate of the
> condition number if needed.
>
> Patrick
>
> On 1/19/21 1:51 PM, Patrick Dupre wrote:
> > gsl_eigen_nonsymmv_workspace
> > has no member n_evals
> >
> > issue:
> >
> > Diagonalizing
> > double data_3 [] = { 0.0, 0.0, 1.0,
> >             0.0, 0.0, 0.0,
> >             0.0, 0.0, 0.0 } ;
> >
> > I get
> > eigenvalue = 0 +0i
> > eigenvector =
> > 1 +0i
> > 0 +0i
> > 0 +0i
> > eigenvalue = 0 +0i
> > eigenvector =
> > 0 +0i
> > 1 +0i
> > 0 +0i
> > eigenvalue = 0 +0i
> > eigenvector =
> > -1 +0i
> > 0 +0i
> > 3.00625e-292 +0i
> >
> >
> > which is wrong.
> > The last eigenvector is not correct because this matrix is not
> > diagonalizable.
> >
> > I need to identify such matrices.
> >
> >
> > ===========================================================================
> >  Patrick DUPRÃ‰                                 | | email: pdupre@gmx.com
> >  Laboratoire interdisciplinaire Carnot de Bourgogne
> >  9 Avenue Alain Savary, BP 47870, 21078 DIJON Cedex FRANCE
> >  Tel: +33 (0)380395988
> > ===========================================================================
> >
> >
> >> Sent: Tuesday, January 19, 2021 at 6:56 PM
> >> From: "Patrick Alken" <patrick.alken@Colorado.EDU>
> >> To: help-gsl@gnu.org
> >> Subject: Re: eigensystem
> >>
> >> What do you mean by handle it? According to the documentation, if the
> >> function cannot compute all eigenvalues, an error code is returned. In
> >> the case of gsl_eigen_nonsymm, the number of converged eigenvalues is
> >> stored in w->n_evals.
> >>
> >> Patrick
> >>
> >> On 1/19/21 10:33 AM, Patrick Dupre wrote:
> >>> Hello,
> >>>
> >>> Is there a way to handle the possible error of gsl_eigen_nonsymmv ?
> >>>
> >>> For example, when the matrix is not diagonalizable.
> >>>
> >>> Thanks
> >>>
> >>> ===========================================================================
> >>>  Patrick DUPRÃ‰                                 | | email: pdupre@gmx.com
> >>>  Laboratoire interdisciplinaire Carnot de Bourgogne
> >>>  9 Avenue Alain Savary, BP 47870, 21078 DIJON Cedex FRANCE
> >>>  Tel: +33 (0)380395988
> >>> ===========================================================================
> >>>
> >>>
> >>
> >>
>
>

```