make_share: Convert a function from multiple function arguments to a...

Description Usage Arguments Value Examples

Description

Convert a function from multiple function arguments to a single function

Usage

1
make_share(func, arg_fn, arg_gr)

Arguments

func

The function that takes in two function arguments

arg_fn

The function (first) argument name of func

arg_gr

The gradient (second) argument name of func

Value

A new function that evaluates the two arguments together

Examples

1
2
3
quad_share <- function(x){list(sum(x^4), 4*x^3)}
lbfgs_share <- make_share(lbfgs::lbfgs, 'call_eval', 'call_grad')
make_share(lbfgs::lbfgs, 'call_eval', 'call_grad')(quad_share, vars=c(5,-4))

splitfngr documentation built on May 2, 2019, 8:54 a.m.