From hpages at fhcrc.org  Wed Jun 26 00:04:13 2013
From: hpages at fhcrc.org (=?ISO-8859-1?Q?Herv=E9_Pag=E8s?=)
Date: Tue, 25 Jun 2013 15:04:13 -0700
Subject: [Rd] stats::convolve documentation enhancement
In-Reply-To: <51C9EA78.10707@gmail.com>
References: <51C72286.8050405@gmail.com> <51C8954C.2050802@fhcrc.org>
	<51C9EA78.10707@gmail.com>
Message-ID: <51CA13DD.5070300@fhcrc.org>

Hi Michael,

On 06/25/2013 12:07 PM, Michael Moers wrote:
> Hi Herv?,
>
> thank you for the link, I like the convolve2() function, it is
> definitely a more user-friendly version of convolve().
>
> I still believe that convolve() would be worth improving for the R stats
> package, since it is pretty important in signal processing. I think it
> would be great to have a better convolution function.

I totally agree with that.

Cheers,
H.

>
> Thanks and regards,
> Michael
>
> Am 24.06.2013 20:51, schrieb Herv? Pag?s:
>> Hi Michael,
>>
>> There are many issues with stats::convolve() that hopefully one day
>> will be addressed. Full story here:
>>
>>   https://stat.ethz.ch/pipermail/r-devel/2007-February/044529.html
>>
>> The user shouldn't have to worry about the lengths of the arguments:
>> convolve() should take care of doing the zero-padding internally so
>> it's always fast. That's what the proposed convolve2() does (in
>> addition to addressing a few other issues).
>>
>> Cheers,
>> H.
>>
>> On 06/23/2013 09:29 AM, Michael Moers wrote:
>>> Hi,
>>>
>>> the function stats::convolve does not mention efficient usage of the
>>> underlying FFT algorithm, such as
>>>
>>> (a) if type="circular", then length(x)=length(y) should have many
>>> factors (e.g. length(x) = length(y) = 2^n)
>>> (b) if type="open" or "filter", then length(x)+length(y)-1 should have
>>> many factors (e.g. length(x)+length(y)-1 = 2^n)
>>>
>>> In particular the latter may not be obvious to first time users, who may
>>> think that stats::convolve is slow, even though it is fast, if applied
>>> correctly.
>>>
>>> Moreover for zero padding, one may apply stats::nextn to (a) length(x)
>>> or (b)  length(x)+length(y)-1.
>>>
>>>
>>> #Example:
>>>
>>> #correct usage:
>>> x <- rnorm(514289)
>>> y <- rnorm(10000)
>>> #length(x) + length(y) - 1 = 2^19
>>> system.time(convolve(x, y, type="open"))
>>>
>>> #   user  system elapsed
>>> #   1.17    0.02    1.18
>>>
>>>
>>> #incorrect usage:
>>> x <- rnorm(300000)
>>> y <- rnorm(10000)
>>> system.time(convolve(x, y, type = "open"))
>>>
>>> #   user  system elapsed
>>> # 685.31    0.09  691.79
>>>
>>>
>>>
>>>
>>> Thanks and Kind regards,
>>> Michael Moers
>>>
>>>     [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>
>>
>

-- 
Herv? Pag?s

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



[Rd] stats::convolve documentation enhancement
=?ISO-8859-1?Q?Herv=E9_Pag=E8s?=