The LAPACK forum has moved to https://github.com/Reference-LAPACK/lapack/discussions.

Segmentation fault (core dumped) when using DSYEV

Open discussion regarding features, bugs, issues, vendors, etc.

Segmentation fault (core dumped) when using DSYEV

Postby stockhausen » Fri Aug 24, 2007 4:55 pm

Hello,

I am using DSYEV to compute eigenvalues and compilation is fine under cgywin. Here is a simple self contain C program:

Code: Select all
#include <stdio.h>

int main ()
{
   
   double A[16] = {  0.78623,  0.47213,  1.16720,  1.09982,
                       0.47213,  0.58641,  0.95153,  0.88351,
           1.16720,  0.95153,  2.12836,  1.84319,
           1.09982,  0.88351,  1.84319,  2.16045};
   char JOBZ = 'N';
   char UPLO = 'U';
   int N = 4;
   int info;
   int LDA = 4;
   double WORK[4];
   int LWORK = 4;
   double W[4];
   int index;
   
   dsyev_(&JOBZ, &UPLO, &N, A, &LDA, W, WORK, &LWORK, info);

   for (index = 0; index < 4; index++)
      printf("%f\n", W[index]);
}




When I run the exec file, the error that I get is:

Code: Select all
Segmentation fault (core dumped)


Any ideas?

Thanks,

Karl
stockhausen
 
Posts: 7
Joined: Tue Aug 21, 2007 5:19 pm

Postby Julien Langou » Fri Aug 24, 2007 5:08 pm

[1] In the call to DSYEV, you need to give the pointer to INFO not its actual value.
[2] LWORK needs to be at least 3*N-1 and WORK needs to be of size LWORK.

Then this should work.

When you work with bigger matrix you will want to use the optimal workspace in
term of time and not the optimal in term of space. (3*N-1 is optimal in term of space.)

Julien.
Julien Langou
 
Posts: 835
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA

Postby stockhausen » Fri Aug 24, 2007 5:47 pm

Worked like a charm, thanks very much!
stockhausen
 
Posts: 7
Joined: Tue Aug 21, 2007 5:19 pm


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 4 guests