Page 1 of 1
problem with dgeev

Posted:
Wed Apr 16, 2008 12:40 pm
by guillaume_bs
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

Posted:
Wed Apr 16, 2008 12:41 pm
by Julie
Guillaume,
Could you send a piece of your code, please
Thanks
Julie

Posted:
Wed Apr 16, 2008 1:01 pm
by guillaume_bs
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;

Posted:
Wed Apr 16, 2008 1:17 pm
by Julie
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

Posted:
Wed Apr 16, 2008 2:39 pm
by guillaume_bs
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;
}

Posted:
Wed Apr 16, 2008 2:48 pm
by guillaume_bs
Hi
I just add 2 small details :
- the value given for the worksize sounds releven (= 136)
- I ran the Lapack tests, which were normals.

Posted:
Wed Apr 16, 2008 3:03 pm
by Julie
Your code works for me!
(I just did a copy paste and add some printing at the end)
Julie

Posted:
Wed Apr 16, 2008 3:10 pm
by guillaume_bs
:'-(
ok.... i guess i'll go back to matlab...

Posted:
Wed Apr 16, 2008 3:11 pm
by Julie
Guillaume which libraries are you using to link.
I did all my test with Clapack and Ref Blas.
Julie

Posted:
Thu Apr 17, 2008 10:24 am
by guillaume_bs
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 !