Linear Algebra and the C Language/a05m
Determinant: Code study
The function i_RC_mR(A[R_SIZE][C0], A[C_SIZE][C0]); reads the size of the matrix directly from memory.
The function pivotbest_mR(); returns 1, if there is an even change of rows and columns, and returns -1, if there is an odd change of rows and columns.
The function zero_under_pivot_mR(); returns the value of the pivot.
/* ------------------------------------ */
/* ------------------------------------ */
double det_R(
double **A
)
{
double **T = c_mR(A, i_RC_mR(A[R_SIZE][C0], A[C_SIZE][C0]));
double deter=1;
int rc;
for( rc=C1; rc<T[C_SIZE][C0]; rc++)
{
deter *= pivotbest_mR(T,rc);
deter *= zero_under_pivot_mR(T,rc);
}
f_mR(T);
return(deter);
}
/* ------------------------------------ */
/* ------------------------------------ */