I have the following situation.
I do have the function
Expand|Select|Wrap|Line Numbers
- void SwapMatrixColumns(int *matrix, const int rows, const int cols,int source, int target){
- int temp, i;
- for(i=0; i < rows; i++){
- temp=matrix[(i*cols) + source];
- matrix[(i*cols) + source]=matrix[(i*cols) + target];
- matrix[(i*cols) + target]=temp;
- }
- }
Now I do call this function using
Expand|Select|Wrap|Line Numbers
- SwapMatrixColumns(reinterpret_cast<int*>(Hd), ROWS, COLUMNS, RandomInt1, RandomInt2 );
Now I would like to call the same function on only part of the matrix Hd let's say on the first COLUMNS/2 columns of Hd. I tried using the following
Expand|Select|Wrap|Line Numbers
- SwapMatrixColumns(reinterpret_cast<int*>(Hd), ROWS, COLUMNS/2, RandomInt1, RandomInt2 );
I am wondering how to do that without having to write a new Class that will encapsulate all the required processing.
Thanks for any hint.
GA