[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: My vectorized code is slower than a loop
From: |
Andreas Weber |
Subject: |
Re: My vectorized code is slower than a loop |
Date: |
Tue, 18 Oct 2016 19:38:12 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.2.0 |
Am 17.10.2016 um 21:37 schrieb Dave Cottingham 2:
> In the process of writing a routine to compute the Qn statistic of Croux and
> Rousseeuw, I started from the Fortran code they published in their paper
> (C&R, "Time-efficient algorithms for two highly robust estimators of scale")
> and ran into unexpected trouble with one section. Here's a fairly literal
> translation of the original, where x is an array of length n, and left and
> right are also arrays of length n that contain integers:
>
> code snipped
Your script can be simplified to
w = x-x(end:-1:1);
try it out!
Since "if(left(i) <= right(i))" is always true. Perhaps you can provide
a realistic example?
-- Andy