Mixed Operations
These functions perform conversions between Stan containers matrix, vector, row vector and arrays.
matrix
to_matrix
(matrix m)
Return the matrix m
itself.
complex_matrix
to_matrix
(complex_matrix m)
Return the matrix m
itself.
matrix
to_matrix
(vector v)
Convert the column vector v
to a size(v)
by 1 matrix.
complex_matrix
to_matrix
(complex_vector v)
Convert the column vector v
to a size(v)
by 1 matrix.
matrix
to_matrix
(row_vector v)
Convert the row vector v
to a 1 by size(v)
matrix.
complex_matrix
to_matrix
(complex_row_vector v)
Convert the row vector v
to a 1 by size(v)
matrix.
matrix
to_matrix
(matrix M, int m, int n)
Convert a matrix A
to a matrix with m
rows and n
columns filled in column-major order.
complex_matrix
to_matrix
(complex_matrix M, int m, int n)
Convert a matrix A
to a matrix with m
rows and n
columns filled in column-major order.
matrix
to_matrix
(vector v, int m, int n)
Convert a vector v
to a matrix with m
rows and n
columns filled in column-major order.
complex_matrix
to_matrix
(complex_vector v, int m, int n)
Convert a vector v
to a matrix with m
rows and n
columns filled in column-major order.
matrix
to_matrix
(row_vector v, int m, int n)
Convert a row_vector v
to a matrix with m
rows and n
columns filled in column-major order.
complex_matrix
to_matrix
(complex_row_vector v, int m, int n)
Convert a row vector v
to a matrix with m
rows and n
columns filled in column-major order.
matrix
to_matrix
(matrix A, int m, int n, int col_major)
Convert a matrix A
to a matrix with m
rows and n
columns filled in row-major order if col_major
equals 0 (otherwise, they get filled in column-major order).
complex_matrix
to_matrix
(complex_matrix A, int m, int n, int col_major)
Convert a matrix A
to a matrix with m
rows and n
columns filled in row-major order if col_major
equals 0 (otherwise, they get filled in column-major order).
matrix
to_matrix
(vector v, int m, int n, int col_major)
Convert a vector v
to a matrix with m
rows and n
columns filled in row-major order if col_major
equals 0 (otherwise, they get filled in column-major order).
complex_matrix
to_matrix
(complex_vector v, int m, int n, int col_major)
Convert a vector v
to a matrix with m
rows and n
columns filled in row-major order if col_major
equals 0 (otherwise, they get filled in column-major order).
matrix
to_matrix
(row_vector v, int m, int n, int col_major)
Convert a row vector v
to a matrix with m
rows and n
columns filled in row-major order if col_major
equals 0 (otherwise, they get filled in column-major order).
complex_matrix
to_matrix
(complex_row_vector v, int m, int n, int col_major)
Convert a row vector v
to a matrix with m
rows and n
columns filled in row-major order if col_major
equals 0 (otherwise, they get filled in column-major order).
matrix
to_matrix
(array[] real a, int m, int n)
Convert a one-dimensional array a
to a matrix with m
rows and n
columns filled in column-major order.
matrix
to_matrix
(array[] int a, int m, int n)
Convert a one-dimensional array a
to a matrix with m
rows and n
columns filled in column-major order.
complex_matrix
to_matrix
(array[] complex a, int m, int n)
Convert a one-dimensional array a
to a matrix with m
rows and n
columns filled in column-major order.
matrix
to_matrix
(array[] real a, int m, int n, int col_major)
Convert a one-dimensional array a
to a matrix with m
rows and n
columns filled in row-major order if col_major
equals 0 (otherwise, they get filled in column-major order).
matrix
to_matrix
(array[] int a, int m, int n, int col_major)
Convert a one-dimensional array a
to a matrix with m
rows and n
columns filled in row-major order if col_major
equals 0 (otherwise, they get filled in column-major order).
complex_matrix
to_matrix
(array[] complex a, int m, int n, int col_major)
Convert a one-dimensional array a
to a matrix with m
rows and n
columns filled in row-major order if col_major
equals 0 (otherwise, they get filled in column-major order).
matrix
to_matrix
(array[] row_vector vs)
Convert a one-dimensional array of row vectors to a matrix, where the size of the array is the number of rows of the resulting matrix and the length of row vectors is the number of columns.
complex_matrix
to_matrix
(array[] complex_row_vector vs)
Convert a one-dimensional array of row vectors to a matrix, where the size of the array is the number of rows of the resulting matrix and the length of row vectors is the number of columns.
matrix
to_matrix
(array[,] real a)
Convert the two dimensional array a
to a matrix with the same dimensions and indexing order.
matrix
to_matrix
(array[,] int a)
Convert the two dimensional array a
to a matrix with the same dimensions and indexing order. If any of the dimensions of a
are zero, the result will be a \(0 \times 0\) matrix.
complex_matrix
to_matrix
(array[,] complex a )
Convert the two dimensional array a
to a matrix with the same dimensions and indexing order.
vector
to_vector
(matrix m)
Convert the matrix m
to a column vector in column-major order.
complex_vector
to_vector
(complex_matrix m)
Convert the matrix m
to a column vector in column-major order.
vector
to_vector
(vector v)
Return the column vector v
itself.
complex_vector
to_vector
(complex_vector v)
Return the column vector v
itself.
vector
to_vector
(row_vector v)
Convert the row vector v
to a column vector.
complex_vector
to_vector
(complex_row_vector v)
Convert the row vector v
to a column vector.
vector
to_vector
(array[] real a)
Convert the one-dimensional array a
to a column vector.
vector
to_vector
(array[] int a)
Convert the one-dimensional integer array a
to a column vector.
complex_vector
to_vector
(array[] complex a)
Convert the one-dimensional complex array a
to a column vector.
row_vector
to_row_vector
(matrix m)
Convert the matrix m
to a row vector in column-major order.
complex_row_vector
to_row_vector
(complex_matrix m)
Convert the matrix m
to a row vector in column-major order.
row_vector
to_row_vector
(vector v)
Convert the column vector v
to a row vector.
complex_row_vector
to_row_vector
(complex_vector v)
Convert the column vector v
to a row vector.
row_vector
to_row_vector
(row_vector v)
Return the row vector v
itself.
complex_row_vector
to_row_vector
(complex_row_vector v)
Return the row vector v
itself.
row_vector
to_row_vector
(array[] real a)
Convert the one-dimensional array a
to a row vector.
row_vector
to_row_vector
(array[] int a)
Convert the one-dimensional array a
to a row vector.
complex_row_vector
to_row_vector
(array[] complex a)
Convert the one-dimensional complex array a
to a row vector.
array[,] real
to_array_2d
(matrix m)
Convert the matrix m
to a two dimensional array with the same dimensions and indexing order.
array[,] complex
to_array_2d
(complex_matrix m)
Convert the matrix m
to a two dimensional array with the same dimensions and indexing order.
array[] real
to_array_1d
(vector v)
Convert the column vector v
to a one-dimensional array.
array[] complex
to_array_1d
(complex_vector v)
Convert the column vector v
to a one-dimensional array.
array[] real
to_array_1d
(row_vector v)
Convert the row vector v
to a one-dimensional array.
array[] complex
to_array_1d
(complex_row_vector v)
Convert the row vector v
to a one-dimensional array.
array[] real
to_array_1d
(matrix m)
Convert the matrix m
to a one-dimensional array in column-major order.
array[] real
to_array_1d
(complex_matrix m)
Convert the matrix m
to a one-dimensional array in column-major order.
array[] real
to_array_1d
(array[...] real a)
Convert the array a
(of any dimension up to 10) to a one-dimensional array in row-major order.
array[] int
to_array_1d
(array[...] int a)
Convert the array a
(of any dimension up to 10) to a one-dimensional array in row-major order.
array[] complex
to_array_1d
(array[...] complex a)
Convert the array a
(of any dimension up to 10) to a one-dimensional array in row-major order.