ibm_eval2: Evaluate a mapper and its Jacobian

View source: R/mappers.R

ibm_eval2R Documentation

Evaluate a mapper and its Jacobian

Description

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.

See Also

Other mapper methods: bru_mapper_generics, ibm_as_taylor(), ibm_eval(), ibm_inla_subset(), ibm_invalid_output(), ibm_is_linear(), ibm_is_rowwise(), ibm_jacobian(), ibm_n(), ibm_n_output(), ibm_names(), ibm_simplify(), ibm_values()

Examples

m <- bm_linear()
ibm_eval2(m, input = c(1, 3, 4, 5, 2), state = 2)


inlabru documentation built on July 28, 2026, 9:07 a.m.