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)).
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], ...). IfFALSE(default), the repeated mapping columns are contiguous,(x1[1], x1[2], ..., x2[1], x2[2], ...), and the Jacobian is acbind()of the Jacobians of the repeated mappers.If
n_repis a vector,interleavedshould either be a single logical, or a vector of the same length. Each element applies to the correspondingn_reprepetition specification.- ...
Arguments passed on to
bm_scale()
See also
bru_mapper, bru_mapper_generics
Other mappers:
bm_aggregate(),
bm_collect(),
bm_const(),
bm_factor(),
bm_fm_mesh_1d,
bm_fmesher(),
bm_harmonics(),
bm_index(),
bm_linear(),
bm_logitaverage(),
bm_logsumexp(),
bm_marginal(),
bm_matrix(),
bm_mesh_B(),
bm_multi(),
bm_pipe(),
bm_scale(),
bm_shift(),
bm_sum(),
bm_taylor(),
bru_get_mapper(),
bru_mapper()
Other specific bm_repeat method implementations:
ibm_eval(),
ibm_invalid_output(),
ibm_jacobian(),
ibm_linear(),
ibm_n(),
ibm_n_output(),
ibm_values()
Examples
(m0 <- bm_index(3))
#> index
(m <- bm_repeat(m0, 5))
#> repeat(5 x index)
ibm_n(m)
#> [1] 15
ibm_values(m)
#> [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
ibm_jacobian(m, 1:3)
#> 3 x 15 sparse Matrix of class "dgCMatrix"
#>
#> [1,] 1 . . 1 . . 1 . . 1 . . 1 . .
#> [2,] . 1 . . 1 . . 1 . . 1 . . 1 .
#> [3,] . . 1 . . 1 . . 1 . . 1 . . 1
ibm_eval(m, 1:3, seq_len(ibm_n(m)))
#> [1] 35 40 45
# Interleaving and grouping
(m <- bm_repeat(m0, c(2, 1, 2), c(TRUE, FALSE, FALSE)))
#> sum(1 = repeat(2 x index, interleaved), 2 = repeat(3 x index))
ibm_n(m)
#> [1] 15
ibm_values(m)
#> [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
ibm_jacobian(m, 1:3)
#> 3 x 15 sparse Matrix of class "dgCMatrix"
#>
#> [1,] 1 1 . . . . 1 . . 1 . . 1 . .
#> [2,] . . 1 1 . . . 1 . . 1 . . 1 .
#> [3,] . . . . 1 1 . . 1 . . 1 . . 1
ibm_eval(m, 1:3, seq_len(ibm_n(m)))
#> [1] 33 40 47