A `bru_mapper`

sub-class implementation must provide an
`ibm_jacobian()`

method. If the model size 'n' and definition
values 'values' are stored in the object itself, default methods are
available (see Details). Otherwise the
`ibm_n()`

and `ibm_values()`

methods also need to be provided.

## Usage

```
# S3 method for bru_mapper_inla_mesh_2d
ibm_n(mapper, ...)
# S3 method for bru_mapper_inla_mesh_2d
ibm_values(mapper, ...)
# S3 method for bru_mapper_inla_mesh_2d
ibm_jacobian(mapper, input, ...)
# S3 method for bru_mapper_inla_mesh_1d
ibm_n(mapper, ...)
# S3 method for bru_mapper_inla_mesh_1d
ibm_values(mapper, ...)
# S3 method for bru_mapper_inla_mesh_1d
ibm_jacobian(mapper, input, ...)
# S3 method for bru_mapper_index
ibm_invalid_output(mapper, input, state, ...)
# S3 method for bru_mapper_index
ibm_jacobian(mapper, input, state, ...)
# S3 method for bru_mapper_taylor
ibm_n(mapper, inla_f = FALSE, multi = FALSE, ...)
# S3 method for bru_mapper_taylor
ibm_n_output(mapper, input, ...)
# S3 method for bru_mapper_taylor
ibm_values(mapper, inla_f = FALSE, multi = FALSE, ...)
# S3 method for bru_mapper_taylor
ibm_jacobian(mapper, ..., multi = FALSE)
# S3 method for bru_mapper_taylor
ibm_eval(mapper, input = NULL, state = NULL, ...)
# S3 method for bru_mapper_linear
ibm_n(mapper, ...)
# S3 method for bru_mapper_linear
ibm_values(mapper, ...)
# S3 method for bru_mapper_linear
ibm_jacobian(mapper, input, ...)
# S3 method for bru_mapper_matrix
ibm_n(mapper, ...)
# S3 method for bru_mapper_matrix
ibm_values(mapper, ...)
# S3 method for bru_mapper_matrix
ibm_jacobian(mapper, input, state = NULL, inla_f = FALSE, ...)
# S3 method for bru_mapper_factor
ibm_n(mapper, ...)
# S3 method for bru_mapper_factor
ibm_values(mapper, ...)
# S3 method for bru_mapper_factor
ibm_jacobian(mapper, input, ...)
# S3 method for bru_mapper_const
ibm_n(mapper, ...)
# S3 method for bru_mapper_const
ibm_values(mapper, ...)
# S3 method for bru_mapper_const
ibm_jacobian(mapper, input, ...)
# S3 method for bru_mapper_const
ibm_eval(mapper, input, state = NULL, ...)
# S3 method for bru_mapper_scale
ibm_n(mapper, ..., state = NULL, n_state = NULL)
# S3 method for bru_mapper_scale
ibm_n_output(mapper, input, state = NULL, ..., n_state = NULL)
# S3 method for bru_mapper_scale
ibm_values(mapper, ..., state = NULL, n_state = NULL)
# S3 method for bru_mapper_scale
ibm_jacobian(mapper, input, state = NULL, ..., sub_lin = NULL)
# S3 method for bru_mapper_scale
ibm_linear(mapper, input, state, ...)
# S3 method for bru_mapper_scale
ibm_eval(mapper, input, state = NULL, ..., sub_lin = NULL)
# S3 method for bru_mapper_aggregate
ibm_n(mapper, ..., input = NULL, state = NULL, n_state = NULL)
# S3 method for bru_mapper_aggregate
ibm_n_output(mapper, input = NULL, ...)
# S3 method for bru_mapper_aggregate
ibm_values(mapper, ..., state = NULL, n_state = NULL)
# S3 method for bru_mapper_aggregate
ibm_jacobian(mapper, input, state = NULL, ...)
# S3 method for bru_mapper_aggregate
ibm_eval(mapper, input, state = NULL, ..., sub_lin = NULL)
# S3 method for bru_mapper_aggregate
ibm_linear(mapper, input, state, ...)
# S3 method for bru_mapper_logsumexp
ibm_jacobian(mapper, input, state = NULL, ...)
# S3 method for bru_mapper_logsumexp
ibm_eval(mapper, input, state = NULL, ..., sub_lin = NULL)
# S3 method for bru_mapper_logsumexp
ibm_linear(mapper, input, state, ...)
# S3 method for bru_mapper_pipe
ibm_n(mapper, ..., state = NULL)
# S3 method for bru_mapper_pipe
ibm_n_output(mapper, input, state = NULL, ...)
# S3 method for bru_mapper_pipe
ibm_values(mapper, ...)
# S3 method for bru_mapper_pipe
ibm_jacobian(mapper, input, state = NULL, ...)
# S3 method for bru_mapper_pipe
ibm_linear(mapper, input, state, ...)
# S3 method for bru_mapper_pipe
ibm_eval(mapper, input, state = NULL, ...)
# S3 method for bru_mapper_multi
ibm_n(mapper, inla_f = FALSE, multi = FALSE, ...)
# S3 method for bru_mapper_multi
ibm_n_output(mapper, input, ...)
# S3 method for bru_mapper_multi
ibm_values(mapper, inla_f = FALSE, multi = FALSE, ...)
# S3 method for bru_mapper_multi
ibm_is_linear(mapper, multi = FALSE, ...)
# S3 method for bru_mapper_multi
ibm_jacobian(
mapper,
input,
state = NULL,
inla_f = FALSE,
multi = FALSE,
...,
sub_A = NULL
)
# S3 method for bru_mapper_multi
ibm_linear(mapper, input, state, inla_f = FALSE, ...)
# S3 method for bru_mapper_multi
ibm_eval(mapper, input, state = NULL, inla_f = FALSE, ..., pre_A = NULL)
# S3 method for bru_mapper_multi
ibm_invalid_output(mapper, input, state, inla_f = FALSE, multi = FALSE, ...)
# S3 method for bru_mapper_multi
[(x, i, drop = TRUE)
# S3 method for bru_mapper_multi
ibm_names(mapper)
# S3 method for bru_mapper_multi
ibm_names(mapper) <- value
# S3 method for bru_mapper_collect
ibm_n(mapper, inla_f = FALSE, multi = FALSE, ...)
# S3 method for bru_mapper_collect
ibm_n_output(mapper, input, state = NULL, inla_f = FALSE, multi = FALSE, ...)
# S3 method for bru_mapper_collect
ibm_values(mapper, inla_f = FALSE, multi = FALSE, ...)
# S3 method for bru_mapper_collect
ibm_is_linear(mapper, inla_f = FALSE, multi = FALSE, ...)
# S3 method for bru_mapper_collect
ibm_jacobian(
mapper,
input,
state = NULL,
inla_f = FALSE,
multi = FALSE,
...,
sub_lin = NULL
)
# S3 method for bru_mapper_collect
ibm_eval(
mapper,
input,
state,
inla_f = FALSE,
multi = FALSE,
...,
sub_lin = NULL
)
# S3 method for bru_mapper_collect
ibm_linear(mapper, input, state, inla_f = FALSE, ...)
# S3 method for bru_mapper_collect
ibm_invalid_output(mapper, input, state, inla_f = FALSE, multi = FALSE, ...)
# S3 method for bru_mapper_collect
[(x, i, drop = TRUE)
# S3 method for bru_mapper_collect
ibm_names(mapper)
# S3 method for bru_mapper_collect
ibm_names(mapper) <- value
# S3 method for bru_mapper_harmonics
ibm_n(mapper, inla_f = FALSE, ...)
# S3 method for bru_mapper_harmonics
ibm_jacobian(mapper, input, state = NULL, inla_f = FALSE, ...)
```

## Arguments

- mapper
A mapper S3 object, inheriting from

`bru_mapper`

.- ...
Arguments passed on to other methods

- input
Data input for the mapper.

- state
A vector of latent state values for the mapping, of length

`ibm_n(mapper, inla_f = FALSE)`

- inla_f
logical; when

`TRUE`

for`ibm_n()`

and`ibm_values()`

, the result must be compatible with the`INLA::f(...)`

and corresponding`INLA::inla.stack(...)`

constructions. For`ibm_{eval,jacobian,linear}`

, the`input`

interpretation may be different. Implementations do not normally need to do anything different, except for mappers of the type needed for hidden multicomponent models such as "bym2", which can be handled by`bru_mapper_collect`

.- multi
logical; If

`TRUE`

(or positive), recurse one level into sub-mappers- n_state
integer giving the length of the state vector for mappers that have state dependent output size.

- sub_lin
Internal, optional pre-computed sub-mapper information

- sub_A
Internal; precomputed Jacobian matrices.

- pre_A
Internal; precomputed Jacobian matrix

- x
object from which to extract element(s)

- i
indices specifying element(s) to extract

- drop
logical; For

`[.bru_mapper_collect`

, whether to extract an individual mapper when`i`

identifies a single element. If`FALSE`

, a list of sub-mappers is returned (suitable e.g. for creating a new`bru_mapper_collect`

object). Default:`TRUE`

- value
a character vector of up to the same length as the number of mappers in the multi-mapper x

## Value

`[`

-indexing a`bru_mapper_multi`

extracts a subset`bru_mapper_multi`

object (for drop`FALSE`

) or an individual sub-mapper (for drop`TRUE`

, and`i`

identifies a single element)

`[`

-indexing a`bru_mapper_collect`

extracts a subset`bru_mapper_collect`

object (for drop`FALSE`

) or an individual sub-mapper (for drop`TRUE`

, and`i`

identifies a single element)

The

`names()`

method for`bru_mapper_collect`

returns the names from the sub-mappers list

## Details

The

`ibm_eval.bru_mapper_taylor()`

evaluates linearised mapper information at the given`state`

. The`input`

argument is ignored, so that the usual argument order`ibm_eval(mapper, input, state)`

syntax can be used, but also`ibm_eval(mapper, state = state)`

. For a mapper with a named jacobian list, the`state`

argument must also be a named list. If`state`

is`NULL`

, all-zero is assumed.

For `bru_mapper_scale`

, `input`

values without a `scale`

element
are interpreted as no scaling.

For

`bru_mapper_aggregate`

,`input`

should be a list with elements`block`

and`weights`

.`block`

should be a vector of the same length as the`state`

, or`NULL`

, with`NULL`

equivalent to all-1. If`weights`

is`NULL`

, it's interpreted as all-1.

For

`bru_mapper_logsumexp`

,`input`

should be a list with elements`block`

and`weights`

.`block`

should be a vector of the same length as the`state`

, or`NULL`

, with`NULL`

equivalent to all-1. If`weights`

is`NULL`

, it's interpreted as all-1.

`ibm_jacobian`

for`bru_mapper_multi`

accepts a list with named entries, or a list with unnamed but ordered elements. The names must match the sub-mappers, see`ibm_names.bru_mapper_multi()`

. Each list element should take a format accepted by the corresponding sub-mapper. In case each element is a vector, the input can be given as a data.frame with named columns, a matrix with named columns, or a matrix with unnamed but ordered columns.

`ibm_invalid_output`

for`bru_mapper_multi`

accepts a list with named entries, or a list with unnamed but ordered elements. The names must match the sub-mappers, see`ibm_names.bru_mapper_multi()`

. Each list element should take a format accepted by the corresponding sub-mapper. In case each element is a vector, the input can be given as a data.frame with named columns, a matrix with named columns, or a matrix with unnamed but ordered columns.

`ibm_jacobian`

for`bru_mapper_collect`

accepts a list with named entries, or a list with unnamed but ordered elements. The names must match the sub-mappers, see`ibm_names.bru_mapper_collect()`

. Each list element should take a format accepted by the corresponding sub-mapper. In case each element is a vector, the input can be given as a data.frame with named columns, a matrix with named columns, or a matrix with unnamed but ordered columns. When`inla_f=TRUE`

and`hidden=TRUE`

in the mapper definition, the input format should instead match that of the first, non-hidden, sub-mapper.

`ibm_invalid_output`

for`bru_mapper_collect`

accepts a list with named entries, or a list with unnamed but ordered elements. The names must match the sub-mappers, see`ibm_names.bru_mapper_collect()`

. Each list element should take a format accepted by the corresponding sub-mapper. In case each element is a vector, the input can be given as a data.frame with named columns, a matrix with named columns, or a matrix with unnamed but ordered columns.

## See also

bru_mapper for constructor methods, and bru_get_mapper for hooks to extract mappers from latent model object class objects.