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

problem with dgeev

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

problem with dgeev

Postby guillaume_bs » Wed Apr 16, 2008 12:40 pm

Hello

I have some problems using the CLapack dgeev_ routine :
DGEEV( JOBVL, JOBVR, N, A, LDA, WR, WI, VL, LDVL, VR, LDVR, WORK, LWORK, INFO )


When i use it, the arguments that are supposed to be modified (wr, wi, vl and vr) are not ; However, the info argument is set to 0 (= no problem) and the workspace is modified (and it doesn't crash...).

Thank you for your help,

Guillaume
guillaume_bs
 
Posts: 9
Joined: Wed Apr 16, 2008 12:25 pm

Postby Julie » Wed Apr 16, 2008 12:41 pm

Guillaume,
Could you send a piece of your code, please
Thanks
Julie
Julie
 
Posts: 299
Joined: Wed Feb 23, 2005 12:32 am
Location: ICL, Denver. Colorado

Postby guillaume_bs » Wed Apr 16, 2008 1:01 pm

Here is the quote (all the definitions & call of the function)


int info;
double *w, *vect1, *vect2;
int c_m1;
char yes;
int dim = 4;

double matrice[16] ={43,216,254,249,49,198,193,211,48,194,177,171,46,214,225,169};

yes = 'V';
c_m1 = -1;

vect1 = (double *) malloc(dim * dim * sizeof(double));
vect2 = (double *) malloc(dim * dim * sizeof(double));
w = (double *) malloc(dim * dim * sizeof(double));

dgeev_(&yes, &yes, &dim, matrice, &dim, wr, wi, vect1, &dim1, vect2, &dim, w, &c_m1, &info);

free(vect1); free(vect2); free(w);
return info;
guillaume_bs
 
Posts: 9
Joined: Wed Apr 16, 2008 12:25 pm

Postby Julie » Wed Apr 16, 2008 1:17 pm

Guillaume,
here is your mistake:
* LWORK (input) INTEGER
* The dimension of the array WORK. LWORK >= max(1,3*N), and
* if JOBVL = 'V' or JOBVR = 'V', LWORK >= 4*N. For good
* performance, LWORK must generally be larger.
*
* If LWORK = -1, then a workspace query is assumed; the routine
* only calculates the optimal size of the WORK array, returns
* this value as the first entry of the WORK array, and no error
* message related to LWORK is issued by XERBLA.

You need to call the routine twice, the first time with LWORK =-1 to get the work array size then a second time with the correct work size.

En esperant que cela reponde a ta question
Julie
Julie
 
Posts: 299
Joined: Wed Feb 23, 2005 12:32 am
Location: ICL, Denver. Colorado

Postby guillaume_bs » Wed Apr 16, 2008 2:39 pm

Bonjour Julie

Thank you for your answer.
I corrected my mistake ; my bug stopped, but now, when I go into the dgeev routine, it just runs endlessly (on the 2nd entry, when i give the size of the workspace).
Do you have any idea?

Here is my modified code :


{
int info;
double *w, *vect1, *vect2, *wr, *wi;
int c_m1;
char yes;
int dim = 4;
int worksize_int;
double worksize_double;

double matrice[16] ={43,216,254,249,49,198,193,211,48,194,177,171,46,214,225,169};

yes = 'V';
c_m1 = -1;

vect1 = (double *) malloc(dim * dim * sizeof(double));
vect2 = (double *) malloc(dim * dim * sizeof(double));
wr = (double *) malloc(dim * sizeof(double));
wi = (double *) malloc(dim * sizeof(double));


dgeev_(&yes, &yes, &dim, matrice, &dim, wr, wi, vect1, &dim, vect2, &dim, &worksize_double, &c_m1, &info);

worksize_int = (int)worksize_double;
w = (double *) malloc(worksize_int * sizeof(double));

// here is the bug:
dgeev_(&yes, &yes, &dim, matrice, &dim, wr, wi, vect1, &dim, vect2, &dim, w, &worksize_int, &info);



free(vect1); free(vect2); free(w);
return info;
}
guillaume_bs
 
Posts: 9
Joined: Wed Apr 16, 2008 12:25 pm

Postby guillaume_bs » Wed Apr 16, 2008 2:48 pm

Hi

I just add 2 small details :
- the value given for the worksize sounds releven (= 136)
- I ran the Lapack tests, which were normals.
guillaume_bs
 
Posts: 9
Joined: Wed Apr 16, 2008 12:25 pm

Postby Julie » Wed Apr 16, 2008 3:03 pm

Your code works for me!
(I just did a copy paste and add some printing at the end)

Julie
Julie
 
Posts: 299
Joined: Wed Feb 23, 2005 12:32 am
Location: ICL, Denver. Colorado

Postby guillaume_bs » Wed Apr 16, 2008 3:10 pm

:'-(
ok.... i guess i'll go back to matlab...
guillaume_bs
 
Posts: 9
Joined: Wed Apr 16, 2008 12:25 pm

Postby Julie » Wed Apr 16, 2008 3:11 pm

Guillaume which libraries are you using to link.
I did all my test with Clapack and Ref Blas.
Julie
Julie
 
Posts: 299
Joined: Wed Feb 23, 2005 12:32 am
Location: ICL, Denver. Colorado

Postby guillaume_bs » Thu Apr 17, 2008 10:24 am

Hello Julie

Thank you for your time.
As i'm very bad with programming, I did all the linking stuff more or less randomly ; actually i looked at it and it doesn't work anymore (I don't think i modified anything but now I get 16 tonnes of "undefined reference" like
"f77blaswrap.lib(fblaswr.obj) : error LNK2019: unresolved external symbol _zgerc_ referenced in function _f2c_zgerc"
)

So I added to the "additional dependancies" (i use visual studio):
cblaswrap.lib
extras.lib
lapack.lib
matgen.lib
blas.lib
clapack.lib
f77blaswrap.lib
libf2c.lib
tmglib.lib

(I guess it's horrible ; as I said before, it's the 1st time I try to build something...)
Thanks for your help !
guillaume_bs
 
Posts: 9
Joined: Wed Apr 16, 2008 12:25 pm


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 6 guests