refactored determinant to not malloc
fixed memory leak in log_determinant