7.11 Slicing and blocking functions for complex matrices

Stan provides several functions for generating slices or blocks or diagonal entries for matrices.

7.11.1 Columns and rows

complex_vector col(complex_matrix x, int n)
The n-th column of matrix x
Available since 2.30

complex_row_vector row(complex_matrix x, int m)
The m-th row of matrix x
Available since 2.30

7.11.2 Block operations

7.11.2.1 Matrix slicing operations

complex_matrix block(complex_matrix x, int i, int j, int n_rows, int n_cols)
Return the submatrix of x that starts at row i and column j and extends n_rows rows and n_cols columns.
Available since 2.30

complex_vector sub_col(complex_matrix x, int i, int j, int n_rows)
Return the sub-column of x that starts at row i and column j and extends n_rows rows and 1 column.
Available since 2.30

complex_row_vector sub_row(complex_matrix x, int i, int j, int n_cols)
Return the sub-row of x that starts at row i and column j and extends 1 row and n_cols columns.
Available since 2.30

7.11.2.2 Vector slicing operations.

complex_vector head(complex_vector v, int n)
Return the vector consisting of the first n elements of v.
Available since 2.30

complex_row_vector head(complex_row_vector rv, int n)
Return the row vector consisting of the first n elements of rv.
Available since 2.30

complex_vector tail(complex_vector v, int n)
Return the vector consisting of the last n elements of v.
Available since 2.30

complex_row_vector tail(complex_row_vector rv, int n)
Return the row vector consisting of the last n elements of rv.
Available since 2.30

complex_vector segment(complex_vector v, int i, int n)
Return the vector consisting of the n elements of v starting at i; i.e., elements i through through i + n - 1.
Available since 2.30

complex_row_vector segment(complex_row_vector rv, int i, int n)
Return the row vector consisting of the n elements of rv starting at i; i.e., elements i through through i + n - 1.
Available since 2.30