% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mapper_sum.R
\name{bm_sum}
\alias{bm_sum}
\alias{bru_mapper_sum}
\alias{[.bm_sum}
\alias{[.bru_mapper_sum}
\title{Mapper for adding multiple mappers}
\usage{
bm_sum(mappers, single_input = FALSE)

bru_mapper_sum(...)

\method{[}{bm_sum}(x, i, drop = TRUE)

\method{[}{bru_mapper_sum}(x, i, drop = TRUE)
}
\arguments{
\item{mappers}{A list of \code{bru_mapper} objects.}

\item{single_input}{logical. If \code{TRUE}, the input is passed to all
sub-mappers. Otherwise, the input should be a list, data.frame, or matrix.
If the \code{mappers} list has named entries, the \code{input} can reference their
corresponding sub-mapper using its name.}

\item{\dots}{Arguments passed on to \code{\link[=bm_sum]{bm_sum()}}}

\item{x}{object from which to extract element(s)}

\item{i}{indices specifying element(s) to extract}

\item{drop}{logical;
For \verb{[.bm_sum}, whether to extract an individual mapper when
\code{i} identifies a single element. If \code{FALSE}, a list of sub-mappers is
returned (suitable e.g. for creating a new \code{bm_sum} object).
Default: \code{TRUE}}
}
\value{
A \code{bm_sum} object.

\itemize{
\item \code{[}-indexing a \code{bm_sum} extracts a subset
\code{bm_sum} object (for drop \code{FALSE}) or an individual sub-mapper
(for drop \code{TRUE}, and \code{i} identifies a single element)
}
}
\description{
Defines a mapper that adds the effects of each submapper.
The \code{ibm_n()} method returns the sum of \code{ibm_n(mappers[[k]])}, and
\code{ibm_values()} returns \code{seq_len(ibm_n(mapper))}.
}
\examples{
(m <- bm_sum(list(a = bm_index(3), b = bm_index(2))))
ibm_n(m)
ibm_values(m)
ibm_jacobian(m, list(a = 1:3, b = c(1, 1, 2)))
ibm_eval(
  m,
  list(a = 1:3, b = c(1, 1, 2)),
  seq_len(ibm_n(m))
)

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

Other mappers: 
\code{\link{bm_aggregate}()},
\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_taylor}()},
\code{\link{bru_get_mapper}()},
\code{\link{bru_mapper}()}
}
\concept{mappers}
