How and when does MatLab support symatrical vector operations?
1 ビュー (過去 30 日間)
Marc Laub 2020 年 4 月 25 日
終了済み: MATLAB Answer Bot 2021 年 8 月 20 日
my question is following?
I want to do a vector operation and I want to be sure that MatLab takes advantage of symmetrie.
Actually I want to get the nearest neighbour of points, so i have to calculate the distance from every point to each oter point. Since I am only interest about the order and not the distance, I neglect the sqrt since its only time consuming.
So my code loooks like following:
are symmetric, since (Ai-Aj)^2==(Aj-Ai)^2.
ans i want to take advantage of this.
I read about the fact that Matlab uses a differen BLAS when detecting symmetric operations, as you can read here:
So i did the same with my code:
A = rand(10000);
B = rand(10000);
It shows that the difference is nearly 0, maybe 0.001%, sometimes also the asymetric one is the "faster" one.
So is there a possibility to get the advantage of the symmetrie? Or do i have to malually do it and try to linearize the problem and do some logic indexing and hopefully save some time? I mean its clearly a logical operation and MatLab supports them, but how can i benefit from it in my case??
Many thanks in advance,
回答 (0 件)
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!