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.

See Also

Ac_ldiv_B, Ac_ldiv_Bc, Ac_mul_B, Ac_mul_Bc, Ac_rdiv_B, Ac_rdiv_Bc, At_ldiv_B, At_ldiv_Bt, At_mul_B, At_mul_Bt, At_rdiv_B, At_rdiv_Bt, A_ldiv_Bc, A_ldiv_Bt, A_mul_B!, A_mul_Bc, A_mul_Bt, A_rdiv_Bc, A_rdiv_Bt, Bidiagonal, cond, conv2, det, diag, diagind, diagm, diff, eig, eigvals, eigvecs, expm, eye, full, inv, isdiag, ishermitian, isposdef, isposdef!, issym, istril, istriu, logabsdet, logdet, lyap, norm, qrfact, rank, repmat, rot180, rotl90, rotr90, sortrows, sqrtm, SymTridiagonal, trace, Tridiagonal, tril, tril!, triu, triu!, writedlm,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: