Autocorrelation function with ranges

2015-06-27 Thread kerdemdemir via Digitalmars-d-learn
Hi My question is more about Maths than D lang, I am hoping, maybe somebody worked with AutoCorrelation function before. auto autoCorrelation(R)(R range) if (isRandomAccessRange!R) { auto residual = residualPowerOf2(range.length); // Find how many zeros to add auto fftResult

Re: Autocorrelation function with ranges

2015-06-27 Thread Rikki Cattermole via Digitalmars-d-learn
On 27/06/2015 10:29 p.m., kerdemdemir wrote: Hi My question is more about Maths than D lang, I am hoping, maybe somebody worked with AutoCorrelation function before. auto autoCorrelation(R)(R range) if (isRandomAccessRange!R) { auto residual = residualPowerOf2(range.length); //

Re: Autocorrelation function with ranges

2015-06-27 Thread kerdemdemir via Digitalmars-d-learn
On Saturday, 27 June 2015 at 10:37:08 UTC, Rikki Cattermole wrote: No idea about the maths behind it are but: Thanks a lot for your answer anyway. I am hoping even not related with D directly, this discussions may atract people from other languages to D while looking for Domain information.

Re: Autocorrelation function with ranges

2015-06-27 Thread Timon Gehr via Digitalmars-d-learn
On 06/27/2015 12:29 PM, kerdemdemir wrote: Hi My question is more about Maths than D lang, I am hoping, maybe somebody worked with AutoCorrelation function before. auto autoCorrelation(R)(R range) if (isRandomAccessRange!R) { auto residual = residualPowerOf2(range.length); //

Re: Autocorrelation function with ranges

2015-06-27 Thread Timon Gehr via Digitalmars-d-learn
On 06/27/2015 02:17 PM, Timon Gehr wrote: You then also don't need the final map to extract the real part. (This is actually not true, your inverseFFT presumably still returns complex numbers.)

Re: Autocorrelation function with ranges

2015-06-27 Thread kerdemdemir via Digitalmars-d-learn
On Saturday, 27 June 2015 at 12:17:31 UTC, Timon Gehr wrote: This computes a²·a̅ instead of a·a̅. What is the source code for residualPowerOf2? Also is there any performance issues? can I make this faster? Probably you should use http://dlang.org/phobos/std_complex.html#.sqAbs instead.