- #1

- 6

- 0

So I suck at programming, but I need to find the determinant of a complex 6x6 array using GSL in C (not GSL complex, complex.h complex). Here is what has failed so far starting with a 6x6 double complex array named mymatrix:

gsl_matrix_complex_view m = gsl_matrix_complex_view_array(mymatrix, 6, 6);

int s;

gsl_permutation *p = gsl_permutation_alloc(6);

gsl_linalg_complex_LU_decomp(&m.matrix, p, &s);

gsl_complex det2 = gsl_linalg_complex_LU_det(&m.matrix, s);

double complex det1 = GSL_REAL(det2)+I*GSL_IMAG(det2);

I refuse to convert my entire program to GSL's complex stuff if you think that would fix it. Here is the error message when compiling in gcc:

lorenz_odd_1.c: In function ‘det’:

lorenz_odd_1.c:122:1: warning: passing argument 1 of ‘gsl_matrix_complex_view_array’ from incompatible pointer type

/usr/local/include/gsl/gsl_matrix_complex_double.h:128:1: note: expected ‘double *’ but argument is of type ‘__complex__ double *’

gsl_matrix_complex_view m = gsl_matrix_complex_view_array(mymatrix, 6, 6);

int s;

gsl_permutation *p = gsl_permutation_alloc(6);

gsl_linalg_complex_LU_decomp(&m.matrix, p, &s);

gsl_complex det2 = gsl_linalg_complex_LU_det(&m.matrix, s);

double complex det1 = GSL_REAL(det2)+I*GSL_IMAG(det2);

I refuse to convert my entire program to GSL's complex stuff if you think that would fix it. Here is the error message when compiling in gcc:

lorenz_odd_1.c: In function ‘det’:

lorenz_odd_1.c:122:1: warning: passing argument 1 of ‘gsl_matrix_complex_view_array’ from incompatible pointer type

/usr/local/include/gsl/gsl_matrix_complex_double.h:128:1: note: expected ‘double *’ but argument is of type ‘__complex__ double *’

Last edited: