Page 1 of 1

help needed

PostPosted: Fri Sep 07, 2007 3:39 pm
by qwzx0001
:cry: :cry: :cry:
there is my simple code
#include <stdio.h>
#include "mkl.h"

int main(){
double a[3][3];
int ipiv[3];
int i,j,k,info,lda,m,n;
m=4,n=4,lda=4;
a[0][0]=10,a[0][1]=1,a[0][2]=2;
a[1][0]=1,a[1][1]=10,a[1][2]=2;
a[2][0]=10,a[2][1]=1,a[2][2]=20;
sgetrf(m,n,a,lda,ipiv,info);

for(i=0;i<3;i++){
for(j=0;j<3;j++)printf("[%f] ",a[i][j]);
printf("\n");
}
return 0;
}



after i compiled and run it, computer always returns "Segmentation fault"

who can tell me how to make ths simplest thing work ??

PostPosted: Fri Sep 07, 2007 4:14 pm
by qwzx0001
sorry, the code i actually writen is :
#include <stdio.h>
#include "mkl.h"

int main(){
double a[3][3];
int ipiv[3];
int i,j,k,info,lda,m,n;
m=3,n=3,lda=3;
a[0][0]=10,a[0][1]=1,a[0][2]=2;
a[1][0]=1,a[1][1]=10,a[1][2]=2;
a[2][0]=10,a[2][1]=1,a[2][2]=20;
sgetrf(m,n,a,lda,ipiv,info);

for(i=0;i<3;i++){
for(j=0;j<3;j++)printf("[%f] ",a[i][j]);
printf("\n");
}
return 0;
}


which is still segmentation fault

PostPosted: Fri Sep 07, 2007 4:56 pm
by Julien Langou
Code: Select all
sgetrf(&m,&n,a,&lda,ipiv,&info);

PostPosted: Sun Sep 09, 2007 12:09 pm
by qwzx0001
thank u very much ,now, it works