I need this for matrix multiplication, I'm putting any 2 dimensional matrix into 1 dimension by column major order, i.e. the matrix
1 2
3 4
is stored as [1 3 2 4].
To try and figure it out I've worked out the pattern for 2x2 matrices:
data_[1] = data_[1]*b.data_[1] + data_[3]*b.data_[2]
data_[2] = data_[2]*b.data_[1] + data_[4]*b.data_[2]
data_[3] = data_[1]*b.data_[3] + data_[3]*b.data_[4]
data_[4] = data_[2]*b.data_[3] + data_[3]*b.data_[4]
and for 3x3 matrices:
data_[1] = data_[1]*b.data_[1] + data_[4]*b.data_[2] + data_[7]*b.data_[3]
data_[2] = data_[2]*b.data_[1] + data_[5]*b.data_[2] + data_[8]*b.data_[3]
data_[3] = data_[3]*b.data_[1] + data_[6]*b.data_[2] + data_[9]*b.data_[3]
data_[4] = data_[1]*b.data_[4] + data_[4]*b.data_[5] + data_[7]*b.data_[6]
data_[5] = data_[2]*b.data_[4] + data_[5]*b.data_[5] + data_[8]*b.data_[6]
data_[6] = data_[3]*b.data_[4] + data_[6]*b.data_[5] + data_[9]*b.data_[6]
data_[7] = data_[1]*b.data_[7] + data_[4]*b.data_[8] + data_[7]*b.data_[9]
data_[8] = data_[2]*b.data_[7] + data_[5]*b.data_[8] + data_[8]*b.data_[9]
data_[9] = data_[3]*b.data_[7] + data_[6]*b.data_[8] + data_[9]*b.data_[9]
but cant figure out how to put this into a general pattern for any size matrix, except for the obvious data_ = .....
can anyone see a way to do this?
Thanks in advance!