dgels for c

Posted:
Thu May 15, 2008 12:45 pm
by smazuelas
I have some problems with the memory using dgels in a c program.
I am very happy if someone could show me some examples of the use of dgels in c
Thanks

Posted:
Thu May 15, 2008 12:56 pm
by Julie
The best is to post the piece of code that causes you problem, along with the memory allocation.
We will try to solve your problem.
Julie

Posted:
Fri May 16, 2008 5:42 am
by smazuelas
Ok. We use dgels (transa,m, n, nrhs, a, lda, b ,ldb, work, lwork, info);
in this way:
char arg1='N';
int arg2 = cont_rest+2, arg3 = numeroAPs, arg4 = 1, arg6 = cont_rest+2, arg8 = cont_rest+2, arg10, arg11=0;
double arg9=0., *parg9;
arg10=-1;
dgels_(&arg1, &arg2, &arg3, &arg4, matrizfila, &arg6, exponentes, &arg8, &arg9, &arg10, &arg11 );
arg10=rint(arg9);
parg9=(double*)malloc(arg10*sizeof(double));
dgels_(&arg1, &arg2, &arg3, &arg4, matrizfila, &arg6, exponentes, &arg8, parg9, &arg10, &arg11 );
//free(parg9);
parg9=NULL;
where matrizfila and exponentes are (contrest+2)x2 and (contrest+2)x1 matrixes
Thank you very much

Posted:
Fri May 16, 2008 5:16 pm
by Julien Langou
I can not find any obvious mistake in the piece of code you sent.
What error message do you see?

Posted:
Mon May 19, 2008 3:15 pm
by smazuelas
This code works, but the problem is with the memory.
The memory used by this code increase, thus I think is a problem with the memory release

Posted:
Mon May 19, 2008 3:29 pm
by Julien Langou
Sure enough you will have problem with the code has written above,
since you are not 'freeing' parg9. You need to decomment the
free(parg9) statement.

Posted:
Mon May 19, 2008 4:35 pm
by smazuelas
I try with and without the coment free and I always have a memory leak

Posted:
Mon May 19, 2008 5:13 pm
by Julien Langou
LAPACK does not perform any memory allocation, so the memory leak
comes from somewhere else in your code.
Re: dgels for c

Posted:
Wed May 28, 2008 9:32 am
by AlexanderEnaceanu
smazuelas wrote:I have some problems with the memory using dgels in a c program.
I am very happy if someone could show me some examples of the use of dgels in c
Thanks
I was going to ask the same question until I found this thread.thanks for the clarification