matrix[n,k] ns=rep_matrix(0,n,k)
ns
would be a matrix full of 0s with n
rows and k
columns:
yes i saw that, will not be a n by k array n consisting of copies of matrix nxk with 0 ?
The doc at the link above says
matrix rep_matrix(real x, int m, int n)
Return the m by n matrix consisting of copies of x.
so I think it should just return a matrix filled will copies of x
(which is your case is just the real number 0).
what is the difference of this: matrix [n, k] ns = rep_matrix (0, n, k) from this matrix [n, k] rep_matrix (0, n, k) i.e without “ns” what returns?
An error I think. You need the ns
here (or any other name, it doesn’t have to be ns
) because that’s the name of the variable that the matrix is assigned to. So this line
matrix [n, k] ns = rep_matrix (0, n, k)
tells Stan to create an n by k matrix with the name ns
, so that later you can refer to this matrix just by ns
.
- you are right! So, it does not create a list (array>2-dimensional?) right?
- The "matrix[n,k] x[p] " what creates?
thanks a lot for your time
-
Yeah just a single matrix
-
matrix[n,k] x[p]
would create an array containingp
matrices, each of which has dimensionsn
byk
.
thank you so much :)