Page 1 of 1

Error calling Sgels

PostPosted: Thu Sep 10, 2009 2:14 pm
by jrk1982
I'm trying to write a small piece of test code for sgels. I get an error
"Invalid value for parameter -8".

Code:

int main(int argc, char** argv)
{
#ifdef NDEBUG
int M = 2;
#else
int M = 2;
#endif
int N = 4;
int LWORK = 0;
culaStatus status;

float* A = NULL , *b = NULL;

float A1[8] = {0.1209, 0.8746, 0.5964, 0.6757, 0.6432, 0.3369, 0.4949, 0.4142};
float b1[4] = {0.0892, 0.5664, 0.5626, 0.1655};

A = A1;
b = b1;

status = culaInitialize();
checkStatus(status);

printf("Calling SGELS\n");

status = culaSgels('N',
M,
N,
M,
(culaFloat *)A,
M,
(culaFloat *)b,
M);

checkStatus(status);

printf("Shutting down CULA\n");
culaShutdown();

return EXIT_SUCCESS;
}

Re:Error calling Sgels

PostPosted: Thu Sep 10, 2009 2:42 pm
by kyle
jrk1982,

Our interface follows a convention similar to the LAPACK interface. For your example, LDB (parameter 8) must be greater than the maximum of N or M.

Re:Error calling Sgels

PostPosted: Thu Sep 10, 2009 6:23 pm
by dan
jrk1982,

Also note that you're freeing memory on the stack. While this isn't related to the ldb error, it will be a problem sometime in the future.

Dan

Re:Error calling Sgels

PostPosted: Thu Sep 10, 2009 6:50 pm
by jrk1982
Thanks. Copy paste error :) I will try the suggestion tomorrow and update.