Friday 13 April 2012

Row Major / Column Major

My notes and the internet are really letting me down today... There is a large discrepancy going on about column vs row major array indexing, apparently.

Things that everyone can agree on:

We have this array:

1 2 3
4 5 6

This is stored as 1 2 3 4 5 6 in row major, and 1 4 2 5 3 6 in column major. Makes sense.

I would call this a 2x3 matrix. BUT do column major/row major consider it to be different?


A(1,2) = 2 seems right to me.
A(1,2) = 4 is this ever true?!
 
I don't think so... 

Maybe we only have to switch things up when we're converting between 2 different programming languages (ie. C and fortran). 

No comments:

Post a Comment