Thanks a lot for the reply.
I am sorry, I did copy the matrix A into tmp_ptr. So, the code is like:
(exactly as you suggested in the reply):
double get_det(gsl_matrix * A) {
int sign=0; double det=0.0; int row_sq = A->size1;
gsl_permutation * p = gsl_permutation_calloc(row_sq);
gsl_matrix * tmp_ptr = gsl_matrix_calloc(row_sq, row_sq);
int * signum = &sign;
gsl_matrix_memcpy(tmp_ptr, A);
gsl_linalg_LU_decomp(tmp_ptr, p, signum);
det = gsl_linalg_LU_det(tmp_ptr, *signum);
gsl_permutation_free(p);
gsl_matrix_free(tmp_ptr);
return det;
}
It doesnt work, even for simple 2X2 or 3X3 matrices.
-Nomesh