rtmb_vector: Create an AD-compatible vector

View source: R/math_functions.R

rtmb_vectorR Documentation

Create an AD-compatible vector

Description

Creates a fixed-length vector that is safe to use inside 'rtmb_code()' when subsequent assignments may involve RTMB automatic-differentiation values. This is a safer alternative to 'numeric(length)' in model code.

Usage

rtmb_vector(value = 0, length, seed = NULL)

Arguments

value

Initial value. Usually a scalar such as '0'.

length

Length of the vector.

seed

Optional AD value used to create the container. Usually this can be left as 'NULL'; inside 'rtmb_code()', BayesRTMB automatically provides an AD seed from the model parameters when available.

Value

An AD-compatible vector.


BayesRTMB documentation built on Nov. 24, 2026, 9:06 a.m.