GELS parameter error -6

General CULA Dense (LAPACK & BLAS) support and troubleshooting. Use this forum if you are having a general problem or have encountered a bug.

GELS parameter error -6

Postby berniwien » Tue Mar 30, 2010 9:25 am

Hi
maybe someone off you can help we with that.
I try to solve a mini overdetermined system with culaSgels, and always get the parameter error -6 back.
Thanks for your help.

my code snippet:

culaStatus status;
status = culaInitialize();

int i;
int N=3;
int M=5;

culaFloat* A = NULL;
culaFloat* B = NULL;
culaFloat* X = NULL;

printf("Allocating Matrices\n");
A = (culaFloat*)malloc(N*M*sizeof(culaFloat));
B = (culaFloat*)malloc(N*sizeof(culaFloat));
X = (culaFloat*)malloc(N*sizeof(culaFloat));

printf("Initializing CULA\n");
status = culaInitialize();
checkStatus(status);

B[0]=2;B[1]=2;B[2]=0;

A[0]=1;A[5]=2;A[10]=3;
A[1]=1;A[6]=1;A[11]=1;
A[2]=3;A[7]=3;A[12]=1;
A[3]=4;A[8]=7;A[13]=2;
A[4]=8;A[9]=3;A[14]=7;

printf("Calling culaSgesv\n");
status = culaSgels('N', 5, 3, 1, A, 3, B, 1);
// status = culaSgels('N',M,N,1,A,N,B,1);
checkStatus(status);

printf("Cula Output A: \n%f %f %f\n%f %f %f \n%f %f %f\n",A[0],A[3],A[6],A[1],A[4],A[7],A[2],A[5],A[8]);
printf("Cula Output B: \n%f\n %f \n %f\n",B[0],B[1],B[2]);
printf("Cula Output X: \n%f\n %f \n %f\n",X[0],X[1],X[2]);

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

free(A);
free(B);
free(IPIV);
berniwien
 
Posts: 1
Joined: Tue Mar 30, 2010 3:57 am

Re:GELS parameter error -6

Postby john » Tue Mar 30, 2010 9:32 am

Check out the API reference doc. LDA must be >= M. You'll find that your LDB is wrong as well for a similar reason. You have filled out your LDA and LDB as if the matrices are row major, but they should be column major (it appears that you have the correct intent when you filled in A.)
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm


Return to CULA Dense Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron