TMB Documentation
v1.9.11
|
Array class used by TMB. More...
#include <tmbutils.hpp>
Public Member Functions | |
array (vector< int > dim_) | |
Construct array from dimension vector and fill with zeros. | |
array< Type > | col (int i) |
Extract sub-array with write access Index i refers to the outer-most (i.e. final) dimension. | |
int | cols () |
Number of outer-most dimensions. More... | |
tmbutils::matrix< Type > | matrix () |
Convert TMB array to matrix by keeping the first dimension and collapsing remaining dimensions. More... | |
Type & | operator() (int i1) |
Elementwise subsetting 1D array. Also allowed in general to access the underlying vector of n-dim array. | |
Type & | operator() (int i1, int i2) |
Elementwise subsetting 2D array. | |
Type & | operator() (int i1, int i2, int i3) |
Elementwise subsetting 3D array. | |
Type & | operator() (int i1, int i2, int i3, int i4) |
Elementwise subsetting 4D array. | |
Type & | operator() (int i1, int i2, int i3, int i4, int i5) |
Elementwise subsetting 5D array. | |
Type & | operator() (int i1, int i2, int i3, int i4, int i5, int i6) |
Elementwise subsetting 6D array. | |
Type & | operator() (int i1, int i2, int i3, int i4, int i5, int i6, int i7) |
Elementwise subsetting 7D array. | |
array< Type > | perm (vector< int > p) |
Array permutation. Permutes array dimensions corresponding to permutation vector p. | |
array< Type > | rotate (int n) |
Array rotate (Special case of array permutation) More... | |
int | rows () |
Number of inner-most dimensions. More... | |
void | setdim (vector< int > dim_) |
Sets dimension attribute and updates internal stride. Must be used when e.g. collapsing array dimensions. | |
array< Type > | transpose () |
Array transpose (Special case of array permutation) More... | |
tmbutils::vector< Type > | vec () |
Convert TMB array to vector. | |
Array class used by TMB.
The TMB array class is implemented as an Eigen Array of dynamic length with a dimension attribute. The implementation closely follows the way arrays work in R. Vectorized operations are inherited from the Eigen library.
Definition at line 23 of file tmbutils.hpp.
|
inline |
Number of outer-most dimensions.
Definition at line 188 of file tmbutils.hpp.
|
inline |
Convert TMB array to matrix by keeping the first dimension and collapsing remaining dimensions.
E.g. if array dimension is (n1,n2,n3) the resulting matrix dimension is (n1, n2*n3).
Definition at line 311 of file tmbutils.hpp.
|
inline |
Array rotate (Special case of array permutation)
Rotates array dimension with n steps where n can be any (positive or negative) integer. If e.g. x has dimension [3,4,5,6] then x.rotate(1) has dimension [6,3,4,5].
Definition at line 291 of file tmbutils.hpp.
|
inline |
Number of inner-most dimensions.
Definition at line 195 of file tmbutils.hpp.
|
inline |
Array transpose (Special case of array permutation)
If e.g. x has dimension [3,4,5,6] then x.transpose() has dimension [6,5,4,3].
Definition at line 277 of file tmbutils.hpp.
Referenced by density::contAR2_t< scalartype_ >::operator()().