tests/testthat/test-AnalyticalDerivs.R

context("Analytical Derivs")

expect_silent({
    # attach gradient and hessian analytical function to curve fitting functions
    .dls <- lapply(
        c("doubleLog.Beck", "doubleLog.Elmore", "doubleLog.Gu",
          "doubleLog.Klos", "doubleLog.Zhang", "doubleLog.AG"),
        function (FUN){
            # FUN <- deparse(substitute(fun))
            fun <- get(FUN)
            attr(fun, 'gradient') <- gradf_t(fun) # gradient
            attr(fun, 'hessian')  <- hessf_t(fun) # hessian
            # print(environment(fun))
            # print(fun)
            # print(FUN)
            # assign(FUN, fun, envir = environment(fun)) #environment("namespace:phenofit"))#
            fun
        })
})
eco-hydro/phenofit documentation built on Feb. 8, 2025, 4:22 p.m.