This is an old version, view current version.

6.11 Matrix concatenation

Stan’s matrix concatenation operations append_col and append_row are like the operations cbind and rbind in R.

6.11.0.1 Horizontal concatenation

matrix append_col(matrix x, matrix y)
Combine matrices x and y by column. The matrices must have the same number of rows.
Available since 2.5

matrix append_col(matrix x, vector y)
Combine matrix x and vector y by column. The matrix and the vector must have the same number of rows.
Available since 2.5

matrix append_col(vector x, matrix y)
Combine vector x and matrix y by column. The vector and the matrix must have the same number of rows.
Available since 2.5

matrix append_col(vector x, vector y)
Combine vectors x and y by column. The vectors must have the same number of rows.
Available since 2.5

row_vector append_col(row_vector x, row_vector y)
Combine row vectors x and y of any size into another row vector by appending y to the end of x.
Available since 2.5

row_vector append_col(real x, row_vector y)
Append x to the front of y, returning another row vector.
Available since 2.12

row_vector append_col(row_vector x, real y)
Append y to the end of x, returning another row vector.
Available since 2.12

6.11.0.2 Vertical concatenation

matrix append_row(matrix x, matrix y)
Combine matrices x and y by row. The matrices must have the same number of columns.
Available since 2.5

matrix append_row(matrix x, row_vector y)
Combine matrix x and row vector y by row. The matrix and the row vector must have the same number of columns.
Available since 2.5

matrix append_row(row_vector x, matrix y)
Combine row vector x and matrix y by row. The row vector and the matrix must have the same number of columns.
Available since 2.5

matrix append_row(row_vector x, row_vector y)
Combine row vectors x and y by row. The row vectors must have the same number of columns.
Available since 2.5

vector append_row(vector x, vector y)
Concatenate vectors x and y of any size into another vector.
Available since 2.5

vector append_row(real x, vector y)
Append x to the top of y, returning another vector.
Available since 2.12

vector append_row(vector x, real y)
Append y to the bottom of x, returning another vector.
Available since 2.12