Conclude new distances from periodicity without calculating

2 ビュー (過去 30 日間)
Marc Laub
Marc Laub 2020 年 5 月 5 日
Hell everyone,
my problem is following:
I'm doing a simulation on particle growth and I wan to include neighbourhood relations. So I allocate x,y and z coordinates to every particle and then calculate the order of their nearest neighbours. So that particles near the edge of the coordinate system wont behave different, I build in a periodicity.
So in the image above, the nearest neighbour of particle 1 would be particle 3, not 2. I did that as follows:
dist1 =(dx.^2+dy.^2+dz.^2);
B = Indizes(I);
So variable vol in this case simply represents the edge length of the cube where all coordinates are within.
Now when the particles grow, there are fewer and my statistic within my voume gets worse and what is even worse, my maximum particle size is limited to my total volume, which will affect the result in a limited volume.
In this case I expand my volume, by "zooming out" and simply looking at a larger volume. Since I trated everything periodic bevore, I am simply copying my dataset of point and adapt the coordinates. So my total points are A, then A where x-coords are +1,then A where y-coords are +1 and teh A where x and y-coords are +1 ( at least in my example 2D case here, in my simnulation it will be 3D).
The edges are again treated periodic, so the nearest neighbour of partcle 1 is particle 3''.
The problem now is that calculationg distances is time consuming, and its more time consuming the more often I have to enlarge my volume.
So the question is, if there is a method where I can conclude the newly formed connections between the particles (e.g. 1 and 2') simply from the old distances and the periodicity itsself, without having to recalculate everything?
I could for sure not calculate the distance from every point to every point. I could also just calculate the distance from the first 5k point to all points and the the distance from point 5001 to 10k to every other point. This will save some time since I do not use so much RAM since I am overwritiung the data, but leads to the problem that I will have to calculate the distances in every iteration, which costs in sum more time.
So is there a possibility to do this by just using the distance from one Cube and the periodicity itsself and the assemble the results in a larg distance matrix?
many thanks in advance,
Best regards
PS: is there a way in my code above to profit from symmetric vector operations?
Like in the case A*A' MatLab would use a BLAS that benefits from symmetric operations, but in the case (A-A')^2 MatLab does not, since A-A' is not symmetric, even though (A-A')^2 is symmetric.

回答 (0 件)


Find more on Linear Algebra in Help Center and File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by