How to declare a matrix with all elements set to zero in one statement?

In python one can declare a zero martix with one command:

np.zeros((M,N))

or

np.full((M,N),0.0)

Do we have something similar in stan? Or, do I have to set each element to zero individually, maybe within a loop? In the latter case, I hope this does not affect the computation time (compared to having a single command). I declared the matrix as

matrix[M,N] bases_mat;

Thanks in advance.

matrix[M,N] bases_mat = rep_matrix(0, M, N)

Will do this for you

2 Likes