Matrices in the Machine08 Feb 2020
No matter what we consider the internal representation, the data will be stored linearly in memory. If we are using a programming language like C, we would use something like this to define a two-dimensional array for a 2x2 matrix:
Now, there’s a lot of different ways to represent this, so let’s
say this is without loss of generality. This would give us four
consecutive memory locations. Even if we think of it as a 2D array,
some sort of call like
matrix is equivalent to
Same in any C-like language, such as C++ or Java.
I have no idea how it works in Fortran. But for a lot of interpreted languages, R, Python, MATLAB, etc, memory organization is kind of irrelevant. We are not going to access memory directly like we would in C. I just hope those languages can keep better track of the structures than I can.