| bru_mapper_logsumexp {inlabru} | R Documentation | 
Mapper for log-sum-exp aggregation
Description
Constructs a mapper
that aggregates elements of exp(state), with optional non-negative weighting,
and then takes the log(), so it can be used e.g.
for  v_k=\log[\sum_{i\in I_k} w_i \exp(u_i)]
and v_k=\log[\sum_{i\in I_k} w_i \exp(u_i) / \sum_{i\in I_k} w_i]
calculations.  Relies on the input handling methods for bru_mapper_aggregate,
but also allows the weights to be supplied on a logarithmic scale as log_weights.
To avoid numerical overflow, it uses the common method of internally
shifting the state blockwise;
v_k=s_k+\log[\sum_{i\in I_k} \exp(u_i + \log(w_i)- s_k)],
where s_k=\max_{i\in I_k} u_i + \log(w_i) is the shift for block k.
Usage
bru_mapper_logsumexp(rescale = FALSE, n_block = NULL)
## S3 method for class 'bru_mapper_logsumexp'
ibm_jacobian(mapper, input, state = NULL, ...)
## S3 method for class 'bru_mapper_logsumexp'
ibm_eval(mapper, input, state = NULL, log = TRUE, ..., sub_lin = NULL)
Arguments
rescale | 
 logical; For  
  | 
n_block | 
 Predetermined number of output blocks. If   | 
mapper | 
 A mapper S3 object, inheriting from   | 
input | 
 Data input for the mapper.  | 
state | 
 A vector of latent state values for the mapping,
of length   | 
... | 
 Arguments passed on to other methods  | 
log | 
 logical; control   | 
sub_lin | 
 Internal, optional pre-computed sub-mapper information  | 
Details
For
bru_mapper_logsumexp,inputshould be a list with elementsblockandweights.blockshould be a vector of the same length as thestate, orNULL, withNULLequivalent to all-1. IfweightsisNULL, it's interpreted as all-1.
Methods (by generic)
-  
ibm_eval(bru_mapper_logsumexp): WhenlogisTRUE(default),ibm_eval()forlogsumexpreturns the log-sum-weight-exp value. IfFALSE, thesum-weight-expvalue is returned. 
See Also
bru_mapper, bru_mapper_generics
Other mappers: 
bru_get_mapper(),
bru_mapper(),
bru_mapper.fm_mesh_1d(),
bru_mapper.fm_mesh_2d(),
bru_mapper_aggregate(),
bru_mapper_collect(),
bru_mapper_const(),
bru_mapper_factor(),
bru_mapper_generics,
bru_mapper_harmonics(),
bru_mapper_index(),
bru_mapper_linear(),
bru_mapper_marginal(),
bru_mapper_matrix(),
bru_mapper_mesh_B(),
bru_mapper_multi(),
bru_mapper_pipe(),
bru_mapper_scale(),
bru_mapper_shift(),
bru_mapper_taylor()
Examples
m <- bru_mapper_logsumexp()
ibm_eval2(m, list(block = c(1, 2, 1, 2), weights = 1:4), 11:14)