LAPACK Archives

[Lapack] Problem with "sggev"

Dear Sir/Madam:

I am using the LAPACK library for resolving eigenvalues/vectors problems 
through the "sggev". I used to make the programs on C/C++ and it calls 
the fortran library. I have tested the dgesv function and it works, but 
the sggev function returns bad results. Could you have any idea about?

Thank you very much.

Best regards,

Antonio Ruiz.

My program is very simple:

#include <stdio.h>

extern "C" {
   int sggev_(char *jobvl, char *jobvr, int *n, double *a, int *lda, 
double *b, int *ldb, double *alphar, double *alphai, double *beta,  
double *vl, int *ldvl, double *vr, int *ldvr, double *work, int *work, 
int *info);

int main(){

   int N = 3, lda = 3, ldb = 3, nvr = 9, lwork = 24, nvl = 9, INFO;
   double A[N*N]={6, 5, 4, 5, 3, 2, 4, 2, 1};
   double B[N*N] ={1, 1, 1, 1, 4, 1, 1, 1, 6};

   double VR[N*N], VL[N*N], WORK[8*N];
   double ALPHAR[N], ALPHAI[N], BETA[N];
   char jobvl='N';
   char jobvr='V';

   sggev_(&jobvl, &jobr, &N, A, &lda, B, &ldb, ALPHAR, ALPHAI, BETA, VL, 
&nvl, VR, &nvr, WORK, &lwork, &INFO);

   int i;
   for (i = 0; i<N;i++)
      printf("%lf \n", ALPHAR[i]/BETA[i]);

   return INFO;


<Prev in Thread] Current Thread [Next in Thread>

For additional information you may use the LAPACK/ScaLAPACK Forum.
Or one of the mailing lists, or