make_share {splitfngr} | R Documentation |
Convert a function from multiple function arguments to a single function
Description
Convert a function from multiple function arguments to a single function
Usage
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
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))
[Package splitfngr version 0.1.2 Index]