Skip to contents

Defines a repeated-space mapper that sums the contributions for each copy. The ibm_n() method returns ibm_n(mapper) * n_rep, and ibm_values() returns seq_len(ibm_n(mapper)).

Usage

bru_mapper_repeat(mapper, n_rep)

# S3 method for class 'bru_mapper_repeat'
ibm_n(mapper, ...)

# S3 method for class 'bru_mapper_repeat'
ibm_n_output(mapper, ...)

# S3 method for class 'bru_mapper_repeat'
ibm_values(mapper, ...)

# S3 method for class 'bru_mapper_repeat'
ibm_jacobian(mapper, input, state = NULL, ..., sub_lin = NULL)

# S3 method for class 'bru_mapper_repeat'
ibm_eval(mapper, input, state, ..., sub_lin = NULL)

# S3 method for class 'bru_mapper_repeat'
ibm_linear(mapper, input, state, ...)

# S3 method for class 'bru_mapper_repeat'
ibm_invalid_output(mapper, input, state, ...)

Arguments

mapper

The mapper to be repeated.

n_rep

The number of times to repeat the 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)

sub_lin

Internal, optional pre-computed sub-mapper information

Value

A bru_mapper_repeat object.

Methods (by generic)

  • ibm_jacobian(bru_mapper_repeat): The input should take the format of the repeated submapper.

  • ibm_invalid_output(bru_mapper_repeat): Passes on the input to the corresponding method.

Examples

m <- bru_mapper_repeat(bru_mapper_index(3), 4)
ibm_n(m)
#> [1] 12
ibm_values(m)
#>  [1]  1  2  3  4  5  6  7  8  9 10 11 12
ibm_jacobian(m, 1:3)
#> 3 x 12 sparse Matrix of class "dgCMatrix"
#>                             
#> [1,] 1 . . 1 . . 1 . . 1 . .
#> [2,] . 1 . . 1 . . 1 . . 1 .
#> [3,] . . 1 . . 1 . . 1 . . 1
ibm_eval(m, 1:3, seq_len(ibm_n(m)))
#> [1] 22 26 30