#include "determinant.h" #include "number.h" #include "rational.h" #include "definitions.cpp" // determinant of a matrix // replaces the matrix by its LU decomposition int determinant_inplace(Number_Matrix M, Number* out){ int i; int sign_correction; LU_dcmp_inplace(M, &sign_correction); if(sign_correction==0){ *out=number_zero(); return(0); } *out=number_one(); if(sign_correction==-1){ number_Qprod_chain(quot(-1,1), out); } for(i=0;i=M.length){ *sign_correction=0; return(0); } // pivot if needed if(pivot!=j){ for(k=0;k