multi_array : using double** from 3rd party lib

Hello,
I have a 3rd party library which exposes a function that takes a double** data argument.
I looked into its source and saw that they use this notation
data[i][j] with i and j varying from imin to imax and j from jmin to jmax
Now I have a boost::multi_array

I have a 3rd party library which exposes a function that takes a double** data argument. I looked into its source and saw that they use this notation data[i][j] with i and j varying from imin to imax and j from jmin to jmax
Now I have a boost::multi_array
marray ... and I wish to pass the "subarray" as a double** argument and call their function. It's not possible, is it?
I do not think it is directly possible without some work. It sounds like you've got pointers-to-pointers a la [1]. You could probably recreate the double** information you need from the subarray, however, and pass that in.
I am actually able to override their function that takes in a double** data.
Can it work then?
Then it will depend a lot on the underlying implementation. - Rhys [1] http://www.fftw.org/fftw3.3alpha_doc/Dynamic-Arrays-in-C_002dThe-Wrong-Way.h...

and I wish to pass the "subarray" as a double** argument and call their function .It's not possible, is it?
you have to create the array of pointers:
double trace(double** arr){
double ret=0;
for(unsigned i=0; i!=4; ++i){
ret+=arr[i][i];
}
return ret;
}
int main(){
boost::multi_array I am actually able to override their function that takes in a double** data. Can it work then? If you can "override" (sic) the function that takes the data, can't
you just replace by some multi_array
participants (3)
-
alfC
-
Hicham Mouline
-
Rhys Ulerich