My matrix multiplication code is
int matMul(int ld, double** matrix)
{
//local variables initialize
omp_set_num_threads(nthreads);
\#pragma omp parallel private(tid,diag,ld) shared(i,j,k,matrix)
{
/* Obtain and print thread id */
tid = omp_get_thread_num();
for ( k=0; k<ld; k++) {
if (matrix[k][k] == 0.0) {
error = 1;
return error;
}
diag = 1.0 / matrix[k][k];
\#pragma omp for
for ( i=k+1; i < ld; i++) {
matrix[i][k] = diag * matrix[i][k];
}
for ( j=k+1; j<ld; j++) {
for ( i=k+1; i<ld; i++) {
matrix[i][j] = matrix[i][j] - matrix[i][k] * matrix[k][j];
}
}
}
}
return error;
}
I assume that it is because of matrix object only but why will it be null even though it is passed as a parameter..