Does setting a transformed parameter to be equal to another parameter make them point to the same place in memory

i have a parameter matrix and an observed matrix of same size. in some cells of the observed matrix are nans, these are fine but they signify that i shouldn’t model with those cells in the matrixes. Because i want my code to be as efficient as possible I want to convert the two matrixes to vectors and then model their relationship in vectorized fashion. so if i initialize a vector and then go through the parameter matrix and set values in the vector to be equal to cells in the matrix can i use the vector to model the values in the matrix cell? will they in effect point to the same space in memory?


No, that would copy the values from the matrix to the vector

1 Like

thanks for the answer!
is there a way i could do this so that the cells in the vector point to the right cells in the parameter matrix?

No, there’s no way to tell Stan to map a container to an existing area in memory

1 Like