isposdef
isposdef(A) -> Bool
Test whether a matrix is positive definite.
Examples
-
Check if a matrix is positive definite:
julia> A = [4 1; 1 4]; julia> isposdef(A) true
This example checks if the matrix
A
is positive definite and returnstrue
. -
Handle non-positive definite matrix:
julia> B = [2 1; 1 2]; julia> isposdef(B) false
It returns
false
since the matrixB
is not positive definite. - Verify positive definiteness of a larger matrix:
julia> C = [5 2 1; 2 9 3; 1 3 6]; julia> isposdef(C) true
It checks the positive definiteness of the matrix
C
and returnstrue
.
Common mistake example:
julia> D = [1 2; 2 1; 1 2];
julia> isposdef(D)
ERROR: MethodError: no method matching isposdef(::Array{Int64,2})
In this example, the input matrix D
is not square, which is a requirement for positive definiteness. Ensure that the matrix passed to isposdef
is a square matrix to avoid such errors.
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.