bug-gsl
[Top][All Lists]
Advanced

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

[Bug-gsl] Problem with gsl_eigen_symmv


From: Alexandra Bac
Subject: [Bug-gsl] Problem with gsl_eigen_symmv
Date: Fri, 27 Feb 2009 17:10:40 +0100

Hi,

I experience the following problem. With the following elementary code :

void Quadriques::dir_courb_principal(gsl_vector *courb, gsl_matrix *dir)
{
  gsl_matrix * M = gsl_matrix_alloc(2,2) ;
  gsl_matrix_set(M, 0, 0, 2. * this->coef[0]) ;
  gsl_matrix_set(M, 0, 1, this->coef[1]) ;
  gsl_matrix_set(M, 1, 0, this->coef[1]) ;
  gsl_matrix_set(M, 1, 1, 2. * this->coef[2]) ;

  gsl_eigen_symmv_workspace * w = gsl_eigen_symmv_alloc (2) ;

  // Compute eigenvectors and eigenvalues
  gsl_eigen_symmv (M, courb, dir, w) ;
  //gsl_eigen_gensymmv_sort (courb, dir, GSL_EIGEN_SORT_VAL_DESC) ;

  gsl_matrix_free(M) ;
}

called with the following coefs array : [5, -7, 2] (that is, I compute the eigenvalues/
vectors of the following matrix :
        10      -7
        -7      2

I get the following eigenvectors :
0.834841        0.550491
-0.550491       0.834841


whereas Maple (and my hand computations) give :



Of cours, the sign does not matter, but ...... x and y's are exchanged !!!!!!

How is it that such problem occurs ?

Thanks in advance.

Alexandra Bac


reply via email to

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