Re: which is faster?
- Posted by Jules <jdavy at dsl.p?pex.co?> Nov 08, 2007
- 643 views
this is what I want to optimise:
global function st_dev(sequence s, atom X) atom m, sum, sd integer l sum = 0 l = length(s) m = mean(s) s -= m for i = 1 to length(s) do sum += power(s[i], 2) end for sd = sqrt(sum/(length(s)-1)) if X = 0 then return sd else -- return the z-score return (X - m)/sd end if end function
can this be improved?