In an (m by n) array stored as double *d
(column major), what is the fastest way of selecting a range of rows and or columns:
double *filter(double *mat, int m, int n, int rows[], int cols[]);
invoked as:
double *B;
int rows[]= {1,3,5}; int cols[]={2,4};
B = filter(A, 5, 4, rows, cols);
which is expected to return a 3-by-2 subset of A consisting of elements (1,2), (1,4), (3,2)...