The LAPACK forum has moved to https://github.com/Reference-LAPACK/lapack/discussions.

help needed

Open discussion regarding features, bugs, issues, vendors, etc.

help needed

Postby qwzx0001 » Fri Sep 07, 2007 3:39 pm

: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 ??
qwzx0001
 
Posts: 3
Joined: Fri Sep 07, 2007 3:35 pm

Postby qwzx0001 » Fri Sep 07, 2007 4:14 pm

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
qwzx0001
 
Posts: 3
Joined: Fri Sep 07, 2007 3:35 pm

Postby Julien Langou » Fri Sep 07, 2007 4:56 pm

Code: Select all
sgetrf(&m,&n,a,&lda,ipiv,&info);
Julien Langou
 
Posts: 835
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA

Postby qwzx0001 » Sun Sep 09, 2007 12:09 pm

thank u very much ,now, it works
qwzx0001
 
Posts: 3
Joined: Fri Sep 07, 2007 3:35 pm


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 4 guests