It is really neither correct nor incorrect, it is really up to you to choose a convention for yourself. Unfortunately.
The problem is that we are used to thinking of x as the first dimension and y as the second dimension, while in linear algebra the first dimension is ‘downwards’ and the second dimension is ‘across’.
Every time, I struggle with choosing a convention, and I personally believe everything would be much nicer if the first index always was the x-direction, and also indicated column (the opposite of today).
So, it’s up to you.
I urge you to not get into the habit of using collect
. It is wasteful and pointless here. Forget you ever heard of that function. Remove it from all your codes, and don’t use until your code stops working without it.