GSL计算矩阵的行列式值

double get_det(gsl_matrix * A)
 {
  double det=0.0; 
  int n = A->size1;
  gsl_permutation *p = gsl_permutation_calloc(n);
  gsl_matrix *tmpA = gsl_matrix_calloc(n, n);
  int signum;
  gsl_matrix_memcpy(tmpA, A);
  gsl_linalg_LU_decomp(tmpA, p, &signum);
  det = gsl_linalg_LU_det(tmpA, signum);
  gsl_permutation_free(p);
  gsl_matrix_free(tmpA);
  return det;
}

http://blog.csdn.net/lovelyloulou/article/details/8002510

你可能感兴趣的:(GSL计算矩阵的行列式值)