TMB Documentation
v1.9.11
|
Array class used by TMB. More...
#include <array.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.
|
inline |
Number of outer-most dimensions.
Definition at line 187 of file array.hpp.
Referenced by array< Type >::col().
|
inline |
|
inline |
Number of inner-most dimensions.
Definition at line 194 of file array.hpp.
Referenced by array< Type >::matrix().
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].