Matriz de cofactores
(necesita de una rutina para calcular determinates)
| Código: |
/* Find the cofactor matrix of a square matrix */ void CoFactor(double **a,int n,double **b) { int i,j,ii,jj,i1,j1; double det; double **c; c = malloc((n-1)*sizeof(double *)); for (j=0;j<n;j++) { /* Form the adjoint a_ij */ /* Calculate the determinate */ /* Fill in the elements of the cofactor */ |
Fuente:
http://local.wasp.uwa.edu.au/~pbourke/other/determinant/
Función determinante en C
La funcion determinante puede ser esta:
| Código: |
/* Recursive definition of determinate using expansion by minors. */ double Determinant(double **a,int n) { int i,j,j1,j2; double det = 0; double **m = NULL; if (n < 1) { /* Error */ } else if (n == 1) { /* Shouldn’t get used */ |