
![]() | Let us write the gridloop1 and gridloop2 functions in C |
![]() | Typical C code:
void gridloop1(double** a, double* xcoor, double* ycoor,
int nx, int ny, Fxy func1)
{
int i, j;
for (i=0; i<nx; i++) {
for (j=0; j<ny; j++) {
a[i][j] = func1(xcoor[i], ycoor[j])
}
|
![]() | Problem: NumPy arrays use single pointers to data |
![]() | The above function represents a as a double pointer (common in C for two-dimensional arrays) |