5.7 Broadcast functions
The following broadcast functions allow vectors, row vectors and matrices to be created by copying a single element into all of their cells. Matrices may also be created by stacking copies of row vectors vertically or stacking copies of column vectors horizontally.
(real x, int m)
Return the size m (column) vector consisting of copies of x.
(real x, int n)
Return the size n row vector consisting of copies of x.
(real x, int m, int n)
Return the m by n matrix consisting of copies of x.
(vector v, int n)
Return the m by n matrix consisting of n copies of the (column) vector v of size m.
(row_vector rv, int m)
Return the m by n matrix consisting of m copies of the row vector rv of size n.
Unlike the situation with array broadcasting (see section array broadcasting), where there is a distinction between integer and real arguments, the following two statements produce the same result for vector broadcasting; row vector and matrix broadcasting behave similarly.
vector x; x = rep_vector(1, 3); x = rep_vector(1.0, 3);
There are no integer vector or matrix types, so integer values are automatically promoted.
Construct a symmetric matrix from the lower triangle of A.