mex_sepsq
To compute the Euclidean separation (L2 norm) between two sets of points in MATLAB can be slow and/or memory-hungry. In some cases (most particularly, if you are working with 2D, 3D or 4D data), this function will do it 2-4 times faster than the fastest m-code I've seen (due to Germano Gomes) and hundreds of times faster than a typical memory-efficient nested loop.
NB: for D much greater than 10-15, performance is better using GG's m-script. See the screenshot for a performance plot - green is GG, blue is mex_sepsq.
>> mex_sepsq_demo
A = randn(4, 5000);
B = randn(4, 5000);
C1 = mex_sepsq(A, B);
Elapsed time is 0.201335 seconds.
C2 = sepsq_gg(A, B);
Elapsed time is 0.517755 seconds.
Relative time per implementation: 1.00 2.57
Citar como
Ben Mitch (2025). mex_sepsq (https://www.mathworks.com/matlabcentral/fileexchange/3966-mex_sepsq), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Compatibilidad con las plataformas
Windows macOS LinuxCategorías
Etiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.