r_solver: Gateway for solver written in R

Description Usage Arguments Value Examples

View source: R/r_solver.R

Description

(Mock) gateway to solver that does not perform any external calls and computes the quantity of interest and its jacobian using provided functions. Provided mainly for testing purposes.

Usage

1
2
3
4
5
6
r_solver(
  qoi = function(x) 0,
  jacobian = function(x) rep(0, length(x)),
  nparams = NULL,
  required_args = NULL
)

Arguments

qoi

function to act as the quantity of interest (should return scalar).

jacobian

function to act as the Jacobian matrix for the quantity of interest (should return vector of the same lentgh as its parameter and should be the real Jacobian function for qoi).

nparams

numeric, number of parameters, unspecified if NULL.

required_args

character, mandatory args for run().

Value

An object of classes r_solver and solver

Examples

1
2
s <- r_solver(qoi = function(x) sum(x^2), jacobian = function(x) 2 * x)
run(s, c(10, 1.5))

maciejsmolka/solvergater documentation built on Jan. 1, 2021, 8:28 a.m.