@@ -47,9 +47,10 @@ element index is $1$ and the last element index is $N$.
4747Container variables are serialized in
4848[ column major order] ( https://eli.thegreenplace.net/2015/memory-layout-of-multi-dimensional-arrays ) ,
4949a.k.a. "Fortran" order.
50- In column major-order, all elements of column 1 are listed in ascending order,
50+ In column major-order for a 2-D container , all elements of column 1 are listed in ascending order,
5151followed by all elements of column 2, thus the
52- first index changes the slowest and the last index changes the fastest.
52+ column index changes the slowest and the row index changes the fastest. For higher dimensions,
53+ this generalizes to the last index changing the slowest and first index changing the fastest.
5354
5455To see how this works, consider a 3-dimensional variable with dimension sizes 2, 3, and 4,
5556e.g., an array of matrices, a 2-D array of vectors or row_vectors, or a 3-D array of scalars.
@@ -60,11 +61,11 @@ Given a Stan program with model parameter variable:
6061The Stan CSV file will require 24 columns to output the elements of ` foo ` .
6162The first 6 columns will be labeled:
6263```
63- foo.1.1.1, foo.1 .1.2, foo.1.1.3, foo.1.1.4, foo.1.2 .1, foo.1.2.2
64+ foo.1.1.1,foo.2 .1.1, foo.1.2.1, foo.2.2.1, foo.1.3 .1,foo.2.3.1
6465```
6566The final 6 columns will be labeled:
6667```
67- foo.2.2.3, foo.2.2 .4, foo.2.3.1, foo.2.3.2, foo.2 .3.3, foo.2.3.4
68+ foo.1.1.4, foo.2.1 .4,foo.1.2.4, foo.2.2.4, foo.1 .3.4, foo.2.3.4
6869```
6970
7071To see how a tuple would be laid out, consider the following variable:
0 commit comments