GSL计算矩阵的行列式值

来源:互联网 发布:mac拆卸软件 编辑:程序博客网 时间:2024/04/30 14:36
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;}


得利用LU分解来得到determinant

原创粉丝点击