approx_grad: Finite-difference Gradient Computer

View source: R/HelperFunctions.R

approx_gradR Documentation

Finite-difference Gradient Computer

Description

Computes finite-difference approximation of gradient given input of arguments x and function fn

Usage

approx_grad(x, fn, eps = sqrt(.Machine$double.eps))

Arguments

x

Numeric vector of function arguments

fn

Function returning list(objective, gradient)

eps

Numeric scalar, finite difference tolerance

Details

Used within efficient_bfgs if needed externally, but internally, this function is actually ignored since when VhalfInv_grad is not supplied, stats::optim() is used instead.

Value

Numeric vector of finite-difference approximated gradient


lgspline documentation built on June 8, 2025, 10:45 a.m.