I wonder if there is a faster solution to the problem lower than using loops.
I have a set of points scattered in three-dimensional space, with a value assigned to each point. So something like dataPoints = [x1, y1, z1, v1; x2, y2, z2, v2; ...] dataPoints = [x1, y1, z1, v1; x2, y2, z2, v2; ...] dataPoints = [x1, y1, z1, v1; x2, y2, z2, v2; ...] . 3D space is evenly subdivided into dx Γ dy Γ dz . I need to create a matrix containing the sum of v in each sub-execution.
The number of subvolumes and data points can be quite large, of the order of 1 million each. Therefore, cycles should indeed be avoided.
I can easily find out which subobject belongs to a point:
ix(:) = floor(x(:) / dx) + 1; iy(:) = floor(y(:) / dy) + 1; iy(:) = floor(z(:) / dz) + 1;
However, now I need to add all the points with one tuple (ix, iy, iz) . Any ideas?
source share