% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mappers.R
\name{ibm_simplify}
\alias{ibm_simplify}
\alias{ibm_simplify.default}
\alias{ibm_simplify.bm_pipe}
\title{Simplify a mapper}
\usage{
ibm_simplify(mapper, input = NULL, state = NULL, ...)

\method{ibm_simplify}{default}(mapper, input = NULL, state = NULL, ...)

\method{ibm_simplify}{bm_pipe}(
  mapper,
  input = NULL,
  state = NULL,
  inla_f = FALSE,
  ...,
  n_state = NULL
)
}
\arguments{
\item{mapper}{A mapper S3 object, inheriting from \code{bru_mapper}.}

\item{input}{Data input for the mapper.}

\item{state}{A vector of latent state values for the mapping,
of length \code{ibm_n(mapper, inla_f = FALSE)}}

\item{...}{Arguments passed on to other methods}

\item{inla_f}{logical; when \code{TRUE} for \code{ibm_n()} and \code{ibm_values()}, the
result must be compatible with the \code{INLA::f(...)} and corresponding
\code{INLA::inla.stack(...)} constructions.  For \verb{ibm_\{eval,jacobian,linear\}},
the \code{input} interpretation may be different.
Implementations do not normally need to do anything different, except
for mappers of the type needed for hidden multicomponent models such
as "bym2", which can be handled by \code{bm_collect}.}

\item{n_state}{integer giving the length of the state vector for mappers
that have state dependent output size.}
}
\value{
The original mapper is returned for non-linear mappers, and the
output of \code{\link[=ibm_linear]{ibm_linear()}} is returned for linear mappers.
}
\description{
Implementations must return a \link{bru_mapper} object.
The default method returns the result of \code{\link[=ibm_linear]{ibm_linear()}} for linear/affine
mappers, and the original \code{mapper} for non-linear mappers.
}
\section{Methods (by class)}{
\itemize{
\item \code{ibm_simplify(default)}: Calls \code{\link[=ibm_linear]{ibm_linear()}} for linear mappers, and returns the original mapper
for non-linear mappers.

\item \code{ibm_simplify(bm_pipe)}: Constructs a simplified \code{pipe} mapper. For fully linear pipes, calls
\code{\link[=ibm_linear]{ibm_linear()}}.
For partially non-linear pipes, replaces each sequence of linear mappers with
a single \code{\link[=bm_taylor]{bm_taylor()}} mapper, while keeping the full list of
original mapper names, allowing the original \code{input} structure to be used
also with the simplified mappers, since the \code{taylor} mappers are not
dependent on inputs.

}}
\seealso{
Other mapper methods: 
\code{\link{bru_mapper_generics}},
\code{\link{ibm_eval}()},
\code{\link{ibm_eval2}()},
\code{\link{ibm_inla_subset}()},
\code{\link{ibm_invalid_output}()},
\code{\link{ibm_is_linear}()},
\code{\link{ibm_is_rowwise}()},
\code{\link{ibm_jacobian}()},
\code{\link{ibm_linear}()},
\code{\link{ibm_n}()},
\code{\link{ibm_n_output}()},
\code{\link{ibm_names}()},
\code{\link{ibm_values}()}
}
\concept{mapper methods}
