Compute the log-determinant of a matrix