I am learning Monte Carlo simulation by C++. I begin with reading codes (from the internet and text books) of the 2D Ising model and the XY model. I find some people define spins simply by a two dimensional array int s[i][j], however, some people use vectors like int *s or int **s together with new int. The body of the code are also a bit different when allocating the value to spins, and I think the case only works with a two dimensional array is more readable.It may be a quite naive to ask, but can anyone help me with what are advantages to use vector and new int type variable? References are also warmly welcome.
What are the tradeoffs of using statically allocated arrays vs. pointers and dynamic allocation?
c++;monte carlo;floating point