I have a huge data set comprised of 3-dimensional nodes (i, j, k)
that form a cube in space. Each node has an x
, y
, z
component to model flow thru the cube. I need to organise these nodes efficiently (large data set) by comparing the delta x
, y
, and z
components so that the difference is machine zero. I did it the time consuming way by starting with the first node and checking against all the others until dx^2 + dy^2 + dz^2 = 0
but the execution takes too long (Big O of N^2). Is there a more efficient way to organise 3D nodes? Thank you.
Asked
Active
Viewed 45 times
0
-
Could you explain more on "_by comparing the delta x, y, and z components so that the difference is machine zero_" ? So what exactly the problem/task is – Khalil Khalaf Jun 20 '16 at 19:05
-
@FirstStep When you measure flow through space, each node has almost exactly the same value as the nodes surrounding it. For example, if a node's x component was +1.0000 kg/s then the node next to it might be x = +1.0001 kg/s. The delta is essentially zero. – CSuch Jun 20 '16 at 20:33
-
Does it make sense to calculate vector average (arithmetic mean) of all nodes, then subtract this from each? – Christopher Oicles Jun 20 '16 at 20:43
-
@ChristopherOicles In a way that could work... Would it be more efficient to subtract the current x, y, and z from all the other nodes and look for any nodes that now equal zero? The average might not work because if x = 1 and y = 2, a match might be x = 2 and y = 1. – CSuch Jun 20 '16 at 21:35
-
I don't have a clear understanding of the problem -- my suggestion would just make all x, y and z, for all nodes, sum to zero -- but it sounds like there are conditions or relationships between components which must remain intact, which are not accounted for by my naive suggestion. – Christopher Oicles Jun 20 '16 at 21:47
-
So hmm, are you just trying to break up your nodes into sets, each containing nodes with identical component values? – Christopher Oicles Jun 20 '16 at 22:01
-
Ok, my final guess: you want to put all the nodes into a big (1-dimensional) list, then sort them by their L2 Norms, so that the nodes whose flows have the greatest magnitudes are on one end, and nodes whose magnitudes are nearest to zero are on the other. Only the magnitude matters -- so we don't care about clustering together nodes with similar values for x, etc. – Christopher Oicles Jun 20 '16 at 22:20
-
@ChristopherOicles I'm sorry that it is difficult to explain. I am modeling flow through a system with each node representing a point in that system. All nodes are almost equal to the nodes surrounding it, but the overall system is changing. I have all values of every node but I need to organize them into an i, j, k space. If the flow was increasing in the i positive direction, you would see the x value increasing by a minuscule amount from node i = n to i = n + 1. When you square the delta value of two neighboring nodes, you should get 0. This implies they are neighbors in the i direction. – CSuch Jun 21 '16 at 02:30
-
I have a physics degree, but I'm still just drooling... Sorry! – Christopher Oicles Jun 21 '16 at 04:48