added log-det method for sparse matrices