help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] Determinant of a matrix:


From: Nomesh Bolia
Subject: [Help-gsl] Determinant of a matrix:
Date: Fri, 11 Feb 2005 12:21:17 +0530 (IST)

Hi,

I am using the following program to compute the determinant of a matrix A:

double get_det(gsl_matrix * A) {
  int sign=0; double det=0.0; int row_sq = mat_ptr->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, mat_ptr);
  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;
}

Basically, the functions:
  
gsl_linalg_LU_decomp(tmp_ptr, p, signum); and 
det = gsl_linalg_LU_det(tmp_ptr, *signum);

have been used to compute the determinant. However, I get completely 
arbitrary answers. 

I would be really grateful if somebody could point out a mistake and/or 
provide a different method to compute the determinant.

Thanks,

-- 
Regards,
Nomesh.

The world is a dangerous place to live; not because of the people who are 
evil, but because of the people who don't do anything about it. -- Albert 
Einstein.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]