First the error:
error: a value of type "float *" cannot be used to initialize an entity of type "float (*)[2000]"
Heres the relevant code:
#define opType float
const int N = 2000;
opType *a_h,*b_h,*d_h, *a_d,*b_d, *d_d;
opType (*normalized_a)[N] = a_h;
opType (*normalized_b)[N] = b_h;
opType (*normalized_d)[N] = d_h;
opType (*normalized_a_d)[N] = a_d;
opType (*normalized_b_d)[N] = b_d;
opType (*normalized_d_d)[N] = d_d;
I am attempting to normalize it to two dimensions so that I can pass a double pointer to a function later on and reference the two dimensions using the shorthand bracket syntax. I am using CUDA so I must have one dimensional declarations for the copying of the memory. Is there any way to make the above work?
This construct is borrowed from http://forums.nvidia.com/index.php?showtopic=83941&view=findpost&p=475901
int linear[10*32]; // linear array
int (*twodim)[32] = linear; // interpreted as a two-dimensional [10][32] array.
assert(&twodim[2][4] == &linear[2*32 + 4]); // these are the same
I don’t see where the data for your array initialization comes from, but the error-message is quite clear:
You declare 6 arrays, each of which contains 2000 float pointers. Of course you can’t initialize one of these arrays with a single float pointer.
So in what form is your base data and how do you want to use it?
Edit:
OK, based on your comment you have got something like
filled with values. In this form you can already access it as myData[i][j]. Now, if you just cast it over to a float pointer like
you can also access it through myDataFlat[i*N+j].