Skip to contents

Create a list of initial values for matrices used to define a compartmental model in TMB.

Usage

MatsList(
  ...,
  .mats_to_save = character(0L),
  .mats_to_return = character(0L),
  .dimnames = list(),
  .structure_labels = NullLabels()
)

Arguments

...

Named objects that can be coerced to numerical matrices.

.mats_to_save

Character vector naming matrices to be saved at each set in the simulation so that some calculations can make use of past value (e.g. delayed effects) and/or to be able to retrieved the simulation history after the simulation is complete.

.mats_to_return

Character vector naming matrices to be returned after the simulate is complete.

.dimnames

Named list of dimnames for matrices that change their dimensions over the simulation steps. These names correspond to the names of the matrices. The output of the simulations will try their best to honor these names, but if the shape of the matrix is too inconsistent with the dimnames then numerical indices will be used instead. For matrices that do not change their dimensions, set dimnames by adding dimnames to the matrices passed to ....

.structure_labels

An optional object for obtaining labels of elements of special vectors and matrices. Such an object can be found in the $labels field of a Compartmental model. Note that this is an advanced technique.

Value

Object of class MatsList with the following methods.

Methods

  • $data_arg(): Return the following components of the data structure to pass to C++.

    • mats -- Unnamed list of numeric matrices.

    • mats_save_hist -- Boolean vector identifying which matrices should have their history saved.

    • mats_return -- Boolean vector identifying which matrices should be returned after a simulation.

  • $mat_dims(): Return a data frame giving the numbers of rows and columns of each matrix in the list.

  • $add_mats(...): Add matrices to the list and return a new regenerated MatsList object.