% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mappers.R
\name{bm_aggregate}
\alias{bm_aggregate}
\alias{bru_mapper_aggregate}
\title{Mapper for aggregation}
\usage{
bm_aggregate(rescale = FALSE, n_block = NULL, type = NULL)

bru_mapper_aggregate(...)
}
\arguments{
\item{rescale}{logical; For \code{bm_aggregate} and \code{bm_logsumexp},
specifies if the blockwise sums should be normalised by the blockwise weight
sums or not:
\itemize{
\item \code{FALSE}: (default) Straight weighted sum, no rescaling.
\item \code{TRUE}: Divide by the sum of the weight values within each block.
This is useful for integration averages, when the given weights are plain
integration weights. If the weights are \code{NULL} or all ones, this is
the same as dividing by the number of entries in each block.
}}

\item{n_block}{Predetermined number of output blocks. If \code{NULL}, overrides
the maximum block index in the inputs. The priority order is \code{input$n_block},
the mapper definition \code{n_block}, then \code{max(input$block)}.}

\item{type}{character; if non-NULL, overrides the \code{rescale} argument, and
constructs an aggregation mapper of the given type instead. Supported
values are "sum", "average" (for regular \code{\link[=bm_aggregate]{bm_aggregate()}}),
"logsumexp", "logaverageexp" (for \code{\link[=bm_logsumexp]{bm_logsumexp()}}), and
"logitaverage" (for \code{\link[=bm_logitaverage]{bm_logitaverage()}}).}

\item{\dots}{Arguments passed on to \code{\link[=bm_aggregate]{bm_aggregate()}}}
}
\description{
Constructs a mapper
that aggregates elements of the input state, so it can be used e.g.
for weighted summation or integration over blocks of values.
}
\examples{
m <- bm_aggregate()
ibm_eval2(m, list(block = c(1, 2, 1, 2), weights = 1:4), 11:14)
ibm_eval2(m, list(block = c(1, 2, 1, 2), weights = 1:4, n_block = 3), 11:14)

}
\seealso{
\link{bru_mapper}, \link{bru_mapper_generics}

Other mappers: 
\code{\link{bm_collect}()},
\code{\link{bm_const}()},
\code{\link{bm_factor}()},
\code{\link{bm_fm_mesh_1d}},
\code{\link{bm_fmesher}()},
\code{\link{bm_harmonics}()},
\code{\link{bm_index}()},
\code{\link{bm_linear}()},
\code{\link{bm_logitaverage}()},
\code{\link{bm_logsumexp}()},
\code{\link{bm_marginal}()},
\code{\link{bm_matrix}()},
\code{\link{bm_multi}()},
\code{\link{bm_pipe}()},
\code{\link{bm_reparam}()},
\code{\link{bm_repeat}()},
\code{\link{bm_scale}()},
\code{\link{bm_shift}()},
\code{\link{bm_sum}()},
\code{\link{bm_taylor}()},
\code{\link{bru_get_mapper}()},
\code{\link{bru_mapper}()}
}
\concept{mappers}
