Hello,

I have a function that calculates the distance between points (points represents two functions)

I’m trying to find a meeting point of those functions. I need to return indexis of point from function A and indexis from function B. I would like to have some dynamic array integers in output.

Thank you very much for your willingness and possible examples or sources.

My function:

**constant** float cpx[N];

**constant** float cpy[N];

**global** void neighboring_points(const float * **restrict** pts_x, const float * **restrict** pts_y, const float doubleRadius, bool * **restrict** neighbors, int* index) {

```
int tid = threadIdx.x + blockDim.x*blockIdx.x;
int k = 0;
while (tid < N) {
float p1x = pts_x[tid];
float p1y = pts_y[tid];
for (int i = N - 1; i > tid; i--) {
float p2x, p2y;
p2x = cpx[i];
p2y = cpy[i];
float dis = sqrtf(((p1x - p2x)*(p1x - p2x)) + ((p1y - p2y)*(p1y - p2y)));// euclidean distance
neighbors[i*N + tid] = (dis <= doubleRadius);// matrix of booleans if neigboring or not
if (neighbors[i*N + tid])
{
printf("points_of_function_A[%d] : %f\n", tid, pts_x[tid]);
printf("points_of_function_B[%d] : %f\n\n", i, pts_x[i]);
//here i want to fill some dynamic arrays to return tid and i. I need know which points are neighboring
}
}
tid += blockDim.x * gridDim.x;
}
```

}