i have a question concerning computation of large array in python( >=3.6.8 ) on Ubuntu SO. I have a large array A, about 20 000 000 (or more) of points (each point is a 3d coordinate x,y,z). I would like to know which of these points are close to a given plane. I use sympy python library for representing point, plane and to compute distance. I have another array T of planes (as sympy object), tipically an array of 7 or 10 elements. For example, for each point p of my A array, and for each t plane, i do something like:
for p in A:
for t in T:
if t.distance(p) <= Delta:
do something
Obviously, if i loop this check for all points and for all plane, i achieve the result after several hours. I done this loop also using processes splitting my array of points in chunks, but also in this way, computation requires a lot of time (hours). I read numpy has where method, but i don't know how to set condition like:
for t in T:
B = A[np.where(t.distance(Point3D(A)) <= 0.1)]
where: t is a sympy plane; Point3D is sympy class for casting generic x,y,z point into sympy point; B is array of A indexes which satisfy condition.
where condition as above reported causes exception :"Nonzero coordinates cannot be removed". Is there some fast approach to compute the loop into 10 or 15 minutes (max)? Thank you in advance. Bye.