bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gsl: francis.c:209: ERROR: maximum iterations reached without finding al


From: Dmitry Cheshkov
Subject: gsl: francis.c:209: ERROR: maximum iterations reached without finding all eigenvalues
Date: Tue, 29 Dec 2020 17:44:55 +0300
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0

Dear Sirs!

I have to calculate the eigenvalues of the following 18x18 real non-symmetric square matrix:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 3
0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 6 0
0 0 0 0 0 0 0 0 0 6 0 3 0 0 0 6 0 3
0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 4 0 2 0 0 0
0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 3 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0
0 6 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0
6 0 3 0 0 0 6 0 3 0 0 0 0 0 0 0 0 0
0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 4 0 2 0 0 0 0 0 0 0 0 0 0 0 0

I wrote the folowing code:

#include <iostream>
#include <fstream>
#include <gsl/gsl_math.h>
#include <gsl/gsl_eigen.h>

using namespace std;

int main(void)
{

  ifstream istr("matrix");
  int N = 18;
  gsl_matrix* m = gsl_matrix_alloc(N, N);
  gsl_vector_complex* eval = gsl_vector_complex_alloc(N);
  gsl_eigen_nonsymm_workspace* w = gsl_eigen_nonsymm_alloc(N);
  for (int i = 0; i < N; i++)
     for (int j = 0; j < N; j++)
        istr >> m->data[N * j + i];
  gsl_eigen_nonsymm(m, eval, w);
  for (int i = 0; i < N; i++)
   cout << eval->data[2 * i] << '\t' << eval->data[2 * i + 1] << endl;
  cout << endl;
  return 0;

}

If the file "matrix" contains the above mentioned matrix, I have the following error:

gsl: francis.c:209: ERROR: maximum iterations reached without finding all eigenvalues
Default GSL error handler invoked.

While Wolfram Mathematica works well:
In[3]:= Eigenvalues[matrix]
Out[3]= {-6, -6, -6, -6, 6, 6, 6, 6, -3, -3, 3, 3, 0, 0, 0, 0, 0, 0}

Is it possible to calculate this eigenvalues using GSL library and how?


With best regards,
Dmitry Cheshkov



reply via email to

[Prev in Thread] Current Thread [Next in Thread]