Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

what is wrong in this program?

evaw
Beginner
347 Views
I am a newcommer to MKL and write a simple test program. It is compiled and linked in VC++6 and VC++8 correctly. But when running to "SGETRS", there is a memory accessing violation. All input parameters seem to be right. Could anyone help me?



#include

#include

#include

#include "mkl.h"



void main()

{

int result;

int r, c, i;

char trans;

int order_a, systems_num, row_a, row_b, para_info;

int *pivot_index;

float*a, *b;



result = 1;



trans = 'N';

order_a = 12;

row_a = order_a;

row_b = order_a;

systems_num = 1;



a = b = NULL;

pivot_index = NULL;

a = (float*)malloc(order_a*order_a*sizeof(float));

b = (float*)malloc(order_a*systems_num*sizeof(float));

pivot_index = (int*)malloc(order_a*sizeof(int));



srand((unsigned)time(NULL));



for(i = 0, c = 0; c < order_a; c++)

for(r = 0; r < order_a; r++)

{

a = (float)rand();

i++;

}



for(i = 0, c = 0; c < systems_num; c++)

for(r = 0; r < order_a; r++)

{

b = (float)rand();

i++;

}



SGETRS(&trans, &order_a, &systems_num, a, &row_a, pivot_index,

b, &row_b, &para_info);

}
0 Kudos
0 Replies
Reply