% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mappers.R, R/mapper_collect.R,
%   R/mapper_repeat.R, R/mapper_sum.R
\name{ibm_jacobian}
\alias{ibm_jacobian}
\alias{ibm_jacobian.default}
\alias{ibm_jacobian.bm_fmesher}
\alias{ibm_jacobian.bm_fm_mesh_1d}
\alias{ibm_jacobian.bm_index}
\alias{ibm_jacobian.bm_taylor}
\alias{ibm_jacobian.bm_linear}
\alias{ibm_jacobian.bm_matrix}
\alias{ibm_jacobian.bm_factor}
\alias{ibm_jacobian.bm_const}
\alias{ibm_jacobian.bm_shift}
\alias{ibm_jacobian.bm_scale}
\alias{ibm_jacobian.bm_aggregate}
\alias{ibm_jacobian.bm_logsumexp}
\alias{ibm_jacobian.bm_logitaverage}
\alias{ibm_jacobian.bm_marginal}
\alias{ibm_jacobian.bm_pipe}
\alias{ibm_jacobian.bm_multi}
\alias{ibm_jacobian.bm_harmonics}
\alias{ibm_jacobian.bm_reparam}
\alias{ibm_jacobian.bm_collect}
\alias{ibm_jacobian.bm_repeat}
\alias{ibm_jacobian.bm_sum}
\title{Jacobian of a mapper}
\usage{
ibm_jacobian(mapper, input, state = NULL, inla_f = FALSE, ...)

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

\method{ibm_jacobian}{bm_fmesher}(mapper, input, ...)

\method{ibm_jacobian}{bm_fm_mesh_1d}(mapper, input, ...)

\method{ibm_jacobian}{bm_index}(mapper, input, state, ...)

\method{ibm_jacobian}{bm_taylor}(mapper, ..., multi = FALSE)

\method{ibm_jacobian}{bm_linear}(mapper, input, ...)

\method{ibm_jacobian}{bm_matrix}(mapper, input, state = NULL, inla_f = FALSE, ...)

\method{ibm_jacobian}{bm_factor}(mapper, input, ...)

\method{ibm_jacobian}{bm_const}(mapper, input, ...)

\method{ibm_jacobian}{bm_shift}(mapper, input, state = NULL, ...)

\method{ibm_jacobian}{bm_scale}(mapper, input, state = NULL, ...)

\method{ibm_jacobian}{bm_aggregate}(mapper, input, state = NULL, ...)

\method{ibm_jacobian}{bm_logsumexp}(mapper, input, state = NULL, ...)

\method{ibm_jacobian}{bm_logitaverage}(mapper, input, state = NULL, ...)

\method{ibm_jacobian}{bm_marginal}(mapper, input, state = NULL, ..., reverse = FALSE)

\method{ibm_jacobian}{bm_pipe}(mapper, input, state = NULL, ...)

\method{ibm_jacobian}{bm_multi}(
  mapper,
  input,
  state = NULL,
  inla_f = FALSE,
  multi = FALSE,
  ...,
  sub_A = NULL
)

\method{ibm_jacobian}{bm_harmonics}(mapper, input, state = NULL, inla_f = FALSE, ...)

\method{ibm_jacobian}{bm_reparam}(mapper, input, state = NULL, ...)

\method{ibm_jacobian}{bm_collect}(
  mapper,
  input,
  state = NULL,
  inla_f = FALSE,
  multi = FALSE,
  ...,
  sub_lin = NULL
)

\method{ibm_jacobian}{bm_repeat}(
  mapper,
  input,
  state = NULL,
  inla_f = FALSE,
  multi = FALSE,
  ...,
  sub_lin = NULL
)

\method{ibm_jacobian}{bm_sum}(
  mapper,
  input,
  state = NULL,
  inla_f = FALSE,
  multi = FALSE,
  ...,
  sub_lin = 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{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{...}{Arguments passed on to other methods}

\item{multi}{logical;
If \code{TRUE} (or positive), recurse one level into sub-mappers}

\item{reverse}{logical; control \code{bm_marginal} evaluation. Default
\code{FALSE}. When \code{TRUE}, reverses the direction of the mapping, see details
for \code{marginal} mappers.}

\item{sub_A}{Internal; precomputed Jacobian matrices.}

\item{sub_lin}{Internal, optional pre-computed sub-mapper information}
}
\description{
Implementations must return a (sparse) matrix of size
\code{ibm_n_output(mapper, input, inla_f)}
by \code{ibm_n(mapper, inla_f = FALSE)}. The \code{inla_f=TRUE} argument should
only affect the allowed type of input format.
}
\section{Methods (by class)}{
\itemize{
\item \code{ibm_jacobian(default)}: Mapper classes must implement their own \code{ibm_jacobian} method.

\item \code{ibm_jacobian(bm_fmesher)}: Returns the \code{\link[fmesher:fm_basis]{fmesher::fm_basis()}} matrix of the
mesh being mapped.

\item \code{ibm_jacobian(bm_fm_mesh_1d)}: Returns the \code{\link[fmesher:fm_basis]{fmesher::fm_basis()}} matrix of the
mesh being mapped.

\item \code{ibm_jacobian(bm_matrix)}: Accepts \code{input} as a matrix, \code{Matrix}, \code{Spatial},
or \code{sfc_POINT} object.

\item \code{ibm_jacobian(bm_shift)}: \code{input} NULL values are interpreted as no shift.

\item \code{ibm_jacobian(bm_scale)}: \code{input} NULL values
are interpreted as no scaling.

\item \code{ibm_jacobian(bm_aggregate)}: \code{input} should be a list with elements \code{block}
and \code{weights}. \code{block}
should be a vector of the same length as the \code{state}, or \code{NULL}, with \code{NULL}
equivalent to all-1.
If \code{weights} is \code{NULL}, it's interpreted as all-1.

\item \code{ibm_jacobian(bm_logsumexp)}: \code{input} should be a list with elements
\code{block} and \code{weights}. \code{block} should be a vector of the same length as the
\code{state}, or \code{NULL}, with \code{NULL} equivalent to all-1.
If \code{weights} is \code{NULL}, it's interpreted as all-1.

\item \code{ibm_jacobian(bm_logitaverage)}: \code{input} should be a list with elements
\code{block} and \code{weights}. \code{block} should be a vector of the same length as the
\code{state}, or \code{NULL}, with \code{NULL} equivalent to all-1.
If \code{weights} is \code{NULL}, it's interpreted as all-1.

\item \code{ibm_jacobian(bm_marginal)}: Non-NULL \code{input} values are interpreted
as a parameter list for \code{qfun}, overriding that of the mapper itself.

\item \code{ibm_jacobian(bm_multi)}: Accepts a list with
named entries, or a list with unnamed but ordered elements.
The names must match the sub-mappers, see \code{\link[=ibm_names.bm_multi]{ibm_names.bm_multi()}}.
Each list element should take a format accepted by the corresponding
sub-mapper. In case each element is a vector, the input can be given as a
data.frame with named columns, a matrix with named columns, or a matrix
with unnamed but ordered columns.

\item \code{ibm_jacobian(bm_collect)}: Accepts a list with
named entries, or a list with unnamed but ordered elements.
The names must match the sub-mappers, see \code{\link[=ibm_names.bm_collect]{ibm_names.bm_collect()}}.
Each list element should take a format accepted by the corresponding
sub-mapper. In case each element is a vector, the input can be given as a
data.frame with named columns, a matrix with named columns, or a matrix
with unnamed but ordered columns. When \code{inla_f=TRUE} and \code{hidden=TRUE} in
the mapper definition, the input format should instead match that of
the first, non-hidden, sub-mapper.

\item \code{ibm_jacobian(bm_repeat)}: The input should take the format of the
repeated submapper.

\item \code{ibm_jacobian(bm_sum)}: Accepts a list with
named entries, or a list with unnamed but ordered elements.
The names must match the sub-mappers, see \code{\link[=ibm_names.bm_sum]{ibm_names.bm_sum()}}.
Each list element should take a format accepted by the corresponding
sub-mapper. In case each element is a vector, the input can be given as a
data.frame with named columns, a matrix with named columns, or a matrix
with unnamed but ordered columns.

}}
\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_linear}()},
\code{\link{ibm_n}()},
\code{\link{ibm_n_output}()},
\code{\link{ibm_names}()},
\code{\link{ibm_simplify}()},
\code{\link{ibm_values}()}
}
\concept{mapper methods}
