R/con_constraints_nonlinear_idx.R

# this is originally a function from the lavaan package.
con_constraints_nonlinear_idx <- function (func = NULL, npar = NULL) {
  if (is.null(func) || is.null(body(func))) 
    return(integer(0L))
  A0 <- lav_func_jacobian_complex(func = func, x = rnorm(npar))
  A1 <- lav_func_jacobian_complex(func = func, x = rnorm(npar))
  A0minA1 <- A0 - A1
  linear <- apply(A0minA1, 1, function(x) all(x == 0))
  which(!linear)
}

Try the restriktor package in your browser

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

restriktor documentation built on Oct. 4, 2023, 9:13 a.m.