bm_repeat: Mapper for repeating a mapper

View source: R/mapper_repeat.R

bm_repeatR Documentation

Mapper for repeating a mapper

Description

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

bm_repeat(mapper, n_rep, interleaved = FALSE)

bru_mapper_repeat(...)

Arguments

mapper

The mapper to be repeated.

n_rep

The number of times to repeat the mapper. If a vector, the non-interleaved repeats are combined into a single repeat mapping, and combined with interleaved repeats via a bm_sum() of mappers.

interleaved

logical; if TRUE, the repeated mapping columns are interleaved; ⁠(x1[1], x2[1], ..., x1[2], x2[2], ...)⁠. If FALSE (default), the repeated mapping columns are contiguous, ⁠(x1[1], x1[2], ..., x2[1], x2[2], ...)⁠, and the Jacobian is a cbind() of the Jacobians of the repeated mappers.

If n_rep is a vector, interleaved should either be a single logical, or a vector of the same length. Each element applies to the corresponding n_rep repetition specification.

...

Arguments passed on to bm_scale()

Value

A bm_repeat or bm_sum object, or the original input mapper.

See Also

bru_mapper, bru_mapper_generics

Other mappers: bm_aggregate(), bm_collect(), bm_const(), bm_expr(), bm_factor(), bm_fm_mesh_1d, bm_fmesher(), bm_harmonics(), bm_index(), bm_linear(), bm_logitaverage(), bm_logsumexp(), bm_marginal(), bm_matrix(), bm_multi(), bm_pipe(), bm_reparam(), bm_scale(), bm_shift(), bm_sum(), bm_taylor(), bru_get_mapper(), bru_mapper()

Examples

(m0 <- bm_index(3))
(m <- bm_repeat(m0, 5))
ibm_n(m)
ibm_values(m)
ibm_jacobian(m, 1:3)
ibm_eval(m, 1:3, seq_len(ibm_n(m)))

# Interleaving and grouping
(m <- bm_repeat(m0, c(2, 1, 2), c(TRUE, FALSE, FALSE)))
ibm_n(m)
ibm_values(m)
ibm_jacobian(m, 1:3)
ibm_eval(m, 1:3, seq_len(ibm_n(m)))


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