Skip to contents

Implementations must return a list with elements offset and jacobian. The input contents must be in a format accepted by ibm_jacobian() for the mapper.

Usage

ibm_eval2(mapper, input, state = NULL, ...)

# Default S3 method
ibm_eval2(mapper, input, state = NULL, ...)

# S3 method for class 'bm_pipe'
ibm_eval2(mapper, input, state = NULL, ...)

# S3 method for class 'bm_expr'
ibm_eval2(mapper, input, state = NULL, ..., data = NULL)

# S3 method for class 'bru_obs'
ibm_eval2(
  mapper,
  input,
  state,
  ...,
  multi = FALSE,
  comp_mappers,
  eval_fun = NULL
)

# S3 method for class 'bru_obs_list'
ibm_eval2(
  mapper,
  input,
  state,
  ...,
  multi = FALSE,
  comp_mappers,
  eval_fun = NULL
)

Arguments

mapper

A mapper S3 object, inheriting from bru_mapper.

input

Data input for the mapper.

state

A vector of latent state values for the mapping, of length ibm_n(mapper, inla_f = FALSE)

...

Arguments passed on to other methods

data

should be a list with data objects, with the main object called data; see bm_expr() for details.

multi

logical; If TRUE (or positive), recurse one level into sub-mappers

comp_mappers

A list of mappers, typically from as_bm_list<bru_comp_list>.

eval_fun

A list of functions, typically from bru_eval_fun().

Value

A list with elements offset and jacobian, where offset is a vector of length ibm_n_output(mapper, input, state, ...), and jacobian is a matrix of size ibm_n_output(mapper, input, state, ...) by ibm_n(mapper, inla_f = FALSE).

Methods (by class)

  • ibm_eval2(default): Calls jacobian <- ibm_jacobian(...) and offset <- ibm_eval(..., jacobian = jacobian) and returns a list with elements offset and jacobian, as needed by ibm_as_taylor.default() and similar methods. Mapper classes can implement their own ibm_eval2 method if joint construction of evaluation and Jacobian is more efficient than separate or sequential construction.

Examples

m <- bm_linear()
ibm_eval2(m, input = c(1, 3, 4, 5, 2), state = 2)
#> $offset
#> [1]  2  6  8 10  4
#> 
#> $jacobian
#> 5 x 1 sparse Matrix of class "dgCMatrix"
#>       
#> [1,] 1
#> [2,] 3
#> [3,] 4
#> [4,] 5
#> [5,] 2
#>