On 7 January 2012 at 11:40, baptiste auguie wrote:
| Hi,
|
| (Rcpp)Armadillo has a 1D convolution function <
| http://arma.sourceforge.net/docs.html#conv >. It might be a very
| inefficient way, to use it sequentially for 2D; I haven't tried.
Good point. Off-list, I already suggested to Hadley t
On 7 January 2012 11:40, baptiste auguie wrote:
> Hi,
>
> (Rcpp)Armadillo has a 1D convolution function <
> http://arma.sourceforge.net/docs.html#conv >. It might be a very
> inefficient way, to use it sequentially for 2D; I haven't tried.
Also, it only works for separable kernels.
baptiste
>
>
Hi,
(Rcpp)Armadillo has a 1D convolution function <
http://arma.sourceforge.net/docs.html#conv >. It might be a very
inefficient way, to use it sequentially for 2D; I haven't tried.
HTH,
baptiste
On 7 January 2012 07:43, Hadley Wickham wrote:
> Hi all,
>
> The rcpp-devel list has been very h
On Fri, Jan 6, 2012 at 2:58 PM, Douglas Bates wrote:
> On Fri, Jan 6, 2012 at 2:02 PM, Hadley Wickham wrote:
>>> What are you doing the timing on? On a modest desktop (2.6 GHz Athlon
>>> X4) I get less than a second for this
>> ...
k <- matrix(runif(20* 20), ncol = 20)
system.time(conv
On Fri, Jan 6, 2012 at 2:02 PM, Hadley Wickham wrote:
>> What are you doing the timing on? On a modest desktop (2.6 GHz Athlon
>> X4) I get less than a second for this
> ...
>>> k <- matrix(runif(20* 20), ncol = 20)
>>> system.time(convolve_2d(x, k))
>> user system elapsed
>> 0.864 0.000
On 6 January 2012 at 13:46, Douglas Bates wrote:
| I didn't make myself clear. What I meant was that it is not possible
| to use asInteger in Rcpp and count on the name being remapped to
| Rf_asInteger.
Right. I had to enforce that a long time ago because the non-prefixed
variants too often clas
> What are you doing the timing on? On a modest desktop (2.6 GHz Athlon
> X4) I get less than a second for this
...
>> k <- matrix(runif(20* 20), ncol = 20)
>> system.time(convolve_2d(x, k))
> user system elapsed
> 0.864 0.000 0.862
Ooops, I must have been using a old k - I now get
> sys
> Fancy indexing tricks aside, another avenue you might want to look
> into is doing the convolution in fourier space ...
I have looked into that, and I'm pretty sure for my case (k much
smaller than x), that it's less efficient (and less numerically
stable). In my experience, it also make the co
> As I said earlier, this construction guarantees that the storage is
> not copied. An Rcpp::NumericVector also uses the storage from R but
> it can be difficult to determine exactly when a copy constructor,
> which actually allocates new storage for an SEXPREC, is invoked.
But that's half the fu
On Fri, Jan 6, 2012 at 1:12 PM, Dirk Eddelbuettel wrote:
>
> On 6 January 2012 at 12:59, Douglas Bates wrote:
> | On Fri, Jan 6, 2012 at 12:39 PM, John Chambers
> wrote:
> | > The "Rf_" part of the API in particular is ugly and somewhat of an add-on
> | > forced in a few examples by the use of s
2012/1/6 Hadley Wickham :
>> I'm coming late to the party but ... I was able to squeeze a couple
>> of milliseconds from the computation by expressing the counts as
>> integers and ensuring that I did not copy x by using an Eigen::Map.
>> It may well be that an Rcpp::NumericVector will not be a co
On 6 January 2012 at 12:59, Douglas Bates wrote:
| On Fri, Jan 6, 2012 at 12:39 PM, John Chambers wrote:
| > The "Rf_" part of the API in particular is ugly and somewhat of an add-on
| > forced in a few examples by the use of some common names in the macro files.
|
| But, as it stands, that is a
Hi,
Fancy indexing tricks aside, another avenue you might want to look
into is doing the convolution in fourier space ...
I'll stop there so I minimize the damage I'm doing as far as spreading
misinformation in a public forum goes. I'm also interested in
investigating that avenue further, as I wr
On Fri, Jan 6, 2012 at 12:43 PM, Hadley Wickham wrote:
> Hi all,
>
> The rcpp-devel list has been very helpful to me so far, so I hope you
> don't mind another question! I'm trying to speed up my 2d convolution
> function:
>
>
>
> library(inline)
> # 2d convolution ---
On Fri, Jan 6, 2012 at 12:39 PM, John Chambers wrote:
> At the risk of derailing this thread into the quicksand of programming style
>
>
> Except when required by the specific application, my preference would be to
> stay with the Rcpp idiom. Mixing in the older C API seems to risk more
> pr
On 6 January 2012 at 10:39, John Chambers wrote:
| At the risk of derailing this thread into the quicksand of programming
| style
Au contraire: thanks for joining in.
| Except when required by the specific application, my preference would be
| to stay with the Rcpp idiom. Mixing in the
Hi all,
The rcpp-devel list has been very helpful to me so far, so I hope you
don't mind another question! I'm trying to speed up my 2d convolution
function:
library(inline)
# 2d convolution -
convolve_2d <- cxxfunction(signature(sam
At the risk of derailing this thread into the quicksand of programming
style
Except when required by the specific application, my preference would be
to stay with the Rcpp idiom. Mixing in the older C API seems to risk
more programming error. Of course, each application is different and
> I'm coming late to the party but ... I was able to squeeze a couple
> of milliseconds from the computation by expressing the counts as
> integers and ensuring that I did not copy x by using an Eigen::Map.
> It may well be that an Rcpp::NumericVector will not be a copy in this
> case but I have f
On 6 January 2012 at 13:00, Steve Lianoglou wrote:
| Hi,
|
| 2012/1/6 Douglas Bates :
| [snip]
| > As I mentioned in another thread, I prefer the idiom
| >
| > int n2 = ::Rf_asInteger(n);
| >
| > because asInteger is part of the R API (in Rcpp it must be called as
| > Rf_asInteger - the :: is a h
Hi,
2012/1/6 Douglas Bates :
[snip]
> As I mentioned in another thread, I prefer the idiom
>
> int n2 = ::Rf_asInteger(n);
>
> because asInteger is part of the R API (in Rcpp it must be called as
> Rf_asInteger - the :: is a hint to the compiler that it will be found
> in the global namespace). F
2012/1/4 Romain François :
> Le 04/01/12 14:29, Hadley Wickham a écrit :
>
>> Hi all,
>>
>> I'm still just getting my feet wet in Rcpp, so please excuse the
>> naivety of my question, but is this the appropriate idiom for treating
>> an input as a C++ scalar?
>>
>> f<- cxxfunction(signature(x = "in
2012/1/4 Hadley Wickham :
>> NumericVector:::iterator is actually alias to double*. Here is a trick
>> (probably does not work on not gcc compilers):
>
> Ah, interesting - thanks!
I'm coming late to the party but ... I was able to squeeze a couple
of milliseconds from the computation by expressin
23 matches
Mail list logo