# logdet

logdet(M)

Log of matrix determinant. Equivalent to `log(det(M))`, but may provide increased accuracy and/or speed.

## Examples

1. Calculate the log determinant of a matrix:

``````julia> M = [1.0 2.0; 3.0 4.0];
julia> logdet(M)
-2.772588722239781``````

This example calculates the log determinant of the matrix `M` using the `logdet` function.

2. Compute the log determinant of a symmetric positive definite matrix:

``````julia> using LinearAlgebra
julia> A = [4.0 1.0; 1.0 2.0];
julia> S = Symmetric(A);
julia> logdet(S)
1.0986122886681098``````

Here, the `logdet` function is used to calculate the log determinant of a symmetric positive definite matrix `S`.

3. Handle a large matrix efficiently:
``````julia> M = rand(1000, 1000);
julia> logdet(M)
-1426.930469399778``````

In this example, the `logdet` function efficiently computes the log determinant of a large matrix `M`.

Common mistake example:

``````julia> A = [0.0 1.0; 1.0 0.0];
julia> logdet(A)
ERROR: PosDefException: matrix is not positive definite; Cholesky factorization failed.``````

In this case, the input matrix `A` is not positive definite, which is a requirement for computing the log determinant. Ensure that the matrix provided is positive definite to avoid this error.