Now I have a matrix B (p*k), different columns of the matrix are involved in each calculation.For example, the first column of the matrix is used for the first computation, and the kth column of the matrix is used for the k th computation.So how do I call each time I use it, and how do I define B in Stan to facilitate the calculation
I’m not sure what you’re trying to do but you can access the columns like this
matrix[p,k] B;
B[:,1] = rep_vector(1.0, p); // set first column
vector[p] last_column = B[:,k]; // get column number `k`