R/checkLocalID.r

Defines functions checkLocalID

##
## INPUT:
## H: Hessian matrix
## fixed: logical indicator for which elements are fixed
##
## RETURN:
## logical for whether 'H' is negative definite
## 
checkLocalID <- function(H, fixed)
{
    H <- H[!fixed, !fixed]

    ## 'chol' returns an error for non-positive definite matrices
    ans <- tryCatch(chol(-H), error = identity)
    ans <- !inherits(ans, "error")
    return(ans)
}

Try the games package in your browser

Any scripts or data that you put into this service are public.

games documentation built on May 2, 2019, 3:26 p.m.