Original Post
Hi there, Quick question: I have a multidimensional array class, and I have recently started optimising parts of my code, using SSE. The array class is used in my matrix library, which is the basis for my entire geometry library. With SSE, I have realised when working with homogenous coordinates, to speed up matrix operations immensely with SSE, it would be convient to store my multidimensional arrays, which are stored as a 1 dimensional array (to improve allocation speeds), in row major order. currently they are stored in column major order. I was very careful when designing it in the first place to make it easy to maintain and upgrade, and I assumed i could simply change my indexing functions (which the entire program uses, to abstract the low level memory management stuff), from this: To this: The change of course being from: x * _mYDim + y To: y * _mXDim + x Where x and y are the indices, and mXDim and mYDim are the dimensions of the array. However, this seems to have some rather, err, adverse effects on my program, which as far as I can tell, shouldnt be happening. Is there a problem with the change I have made here, or is there most likely some other odd mistake I've made?
inline _Real& operator()(const SizeType y,const SizeType x) {return _mData[x * _mYDim + y];};
inline _Real operator()(const SizeType y,const SizeType x)const {return _mData[x * _mYDim + y];};
inline _Real& operator()(const SizeType y,const SizeType x) {return _mData[y * _mXDim + x];};
inline _Real operator()(const SizeType y,const SizeType x)const {return _mData[y * _mXDim + x];};