Return to site

Matlab ismember tolerance

broken image
broken image
broken image

Lk = 4 # 1 relative set, 3 working data sets # get distance matrix A i relative points, j points to be mapped # pick pairs of smallest distance and return corresponding points (or their order) Just in case anybody is interested, the solution looks like this: using Random Now Julia outperforms MATLAB by almost an order of magnitude. I tried to do the same in MATLAB, but maybe in this case I have done it less efficiently. Now you just need to filter out which rows/cols have already been seen, perhaps something like julia> is, js = BitSet(), BitSet() Julia> CartesianIndices(A0)ĬartesianIndex(3, 2) # first, eliminate 3,2 Can’t you avoid this entirely, perhaps call sortperm(vec(A)) which takes 240ms, but only 3 times? A sketch: julia> A0 = rand(Int8, 3,3) This takes 7.4ms, times 1500 times 3 gives about 30s, which is how long (a slightly improved) version takes to run. Any suggestions how I can speed up the code?Īs you say, all the time is in argmin(A). In reality Lp is greater than 1500, which is a real problem for me. I also tried findmin(A), but the performance is the same. # pick pairs of smallest distance & clear these pairs from Aįinding the minimum takes almost all the time and I was wondering if Julia with argmin(A) is maybe faster than MATLAB’s min(A). # create test data: coordinates of relative points and points to be mappedĪ = A + (pload*ones(1,Lj)-ones(Li,1)*pload').^2 I ported a code from MATLAB to Julia, because it takes too long right now: using Random

broken image