Is there a way to improve this basic level multiplication?
Show older comments
Hi all,
I am trying to reduce the computational time of my programme. And I have seen that right now the biggest computational cost is spent on the computation of the matrix T. Here k is a complex number, nodes and point are large matrix. And basically what I'm trying to reproduce is
where X and Y are vectors, one from the nodes matrix and the other from the points matrix. So my idea was to first create a matrix of distances between nodes and points and then multiply each component of this matrix by the exponential factor. For now this is working properly but takes the most computational time and I would like to ask if you know if there is a possible way to reduce this computational time?
P.S. It is my first post in this forum so forgive me for any mistakes I've could done. And feel free to ask whatever.
Thank you all!
dst = pdist2(nodes, points,"euclidean")';
T = exp(-1i*k.*dst)./dst;
3 Comments
Jan
on 20 Jun 2022
Please post some relevant input data, e.g. created by rand().
Alex Bernadí Forteza
on 20 Jun 2022
Jan
on 27 Jun 2022
exp() is very expensive. I've tried to calculate the real and imaginary part separately, but this does not help here.
Answers (0)
Categories
Find more on Direct Search 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!