Re: [Rcpp-devel] Question concerning use of Raster in C vi Rcpp plugin and inline

2010-11-20 Thread Douglas Bates
On Tue, Nov 16, 2010 at 4:31 AM, Rainer M Krug wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi > > I am new to C, and my question might be basic, but I am struggling with it: > > I have about 10 lines of code in a simulation, which take up about 50% > of the whole simulation, As th

Re: [Rcpp-devel] Question concerning use of Raster in C vi Rcpp plugin and inline

2010-11-18 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/17/2010 10:44 AM, Rainer M Krug wrote: > On 11/17/2010 10:26 AM, Romain Francois wrote: >> Le 17/11/10 10:17, Rainer M Krug a écrit : >>> On 11/16/2010 05:49 PM, Douglas Bates wrote: >>> Hi Douglas, >>> I enclose a rewrite which compiles and

Re: [Rcpp-devel] Question concerning use of Raster in C vi Rcpp plugin and inline

2010-11-17 Thread Rainer M Krug
On 11/17/2010 01:57 PM, Dirk Eddelbuettel wrote: > > On 17 November 2010 at 10:44, Rainer M Krug wrote: > | On 11/17/2010 10:26 AM, Romain Francois wrote: > | > Ultimately, making a package is the best action. > | > | True - But I haven't looked at that option yet, as I was happy with > | sourc

Re: [Rcpp-devel] Question concerning use of Raster in C vi Rcpp plugin and inline

2010-11-17 Thread Dirk Eddelbuettel
On 17 November 2010 at 10:44, Rainer M Krug wrote: | On 11/17/2010 10:26 AM, Romain Francois wrote: | > Ultimately, making a package is the best action. | | True - But I haven't looked at that option yet, as I was happy with | sourcing the code, but I will for my next project. Are you sure you h

Re: [Rcpp-devel] Question concerning use of Raster in C vi Rcpp plugin and inline

2010-11-17 Thread Rainer M Krug
On 11/17/2010 10:47 AM, Christian Gunning wrote: > On Tue, Nov 16, 2010 at 4:00 AM, > wrote: >>for ( y in 1:maxy ) { >> cat(y, " ") >> for (x in 1:maxx) { >>s <- seeds[x:(x+dx2), y:(y+dy2)] >>if (all(is.na(s))) { >> dispSeeds[x,y] <- NA >>} else { >

Re: [Rcpp-devel] Question concerning use of Raster in C vi Rcpp plugin and inline

2010-11-17 Thread Romain Francois
Le 17/11/10 10:17, Rainer M Krug a écrit : On 11/16/2010 05:49 PM, Douglas Bates wrote: Hi Douglas, I enclose a rewrite which compiles and executes without changing the arguments. That looks much better and "C like" - thanks a lot. I am not entirely sure that it is doing the correct calcula

Re: [Rcpp-devel] Question concerning use of Raster in C vi Rcpp plugin and inline

2010-11-17 Thread Rainer M Krug
On 11/16/2010 05:49 PM, Douglas Bates wrote: Hi Douglas, > I enclose a rewrite which compiles and executes without changing the > arguments. That looks much better and "C like" - thanks a lot. > I am not entirely sure that it is doing the correct > calculation. I tried to compare the results

Re: [Rcpp-devel] Question concerning use of Raster in C vi Rcpp plugin and inline

2010-11-17 Thread Romain Francois
Le 17/11/10 10:44, Rainer M Krug a écrit : -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/17/2010 10:26 AM, Romain Francois wrote: Le 17/11/10 10:17, Rainer M Krug a écrit : On 11/16/2010 05:49 PM, Douglas Bates wrote: Hi Douglas, I enclose a rewrite which compiles and executes without

[Rcpp-devel] Question concerning use of Raster in C vi Rcpp plugin and inline

2010-11-17 Thread Christian Gunning
On Tue, Nov 16, 2010 at 4:00 AM, wrote: >    for ( y in 1:maxy ) { >      cat(y, " ") >      for (x in 1:maxx) { >        s <- seeds[x:(x+dx2), y:(y+dy2)] >        if (all(is.na(s))) { >          dispSeeds[x,y] <- NA >        } else { >          dispSeeds[x,y] <- fx2(s, s, sd2D) >        } >      

Re: [Rcpp-devel] Question concerning use of Raster in C vi Rcpp plugin and inline

2010-11-17 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/17/2010 10:26 AM, Romain Francois wrote: > Le 17/11/10 10:17, Rainer M Krug a écrit : >> On 11/16/2010 05:49 PM, Douglas Bates wrote: >> Hi Douglas, >> >>> I enclose a rewrite which compiles and executes without changing the >>> arguments. >> >>

Re: [Rcpp-devel] Question concerning use of Raster in C vi Rcpp plugin and inline

2010-11-16 Thread Douglas Bates
I enclose a rewrite which compiles and executes without changing the arguments. I am not entirely sure that it is doing the correct calculation. I tried to compare the results from calls like print(range(sd2D)) set.seed(1234) print(system.time(dispSeedsC <- disperse(seeds.m, sd2D, dispRparForSug

Re: [Rcpp-devel] Question concerning use of Raster in C vi Rcpp plugin and inline

2010-11-16 Thread Douglas Bates
On Tue, Nov 16, 2010 at 9:43 AM, Rainer M Krug wrote: > On 11/16/2010 03:16 PM, Douglas Bates wrote: >> On Tue, Nov 16, 2010 at 4:31 AM, Rainer M Krug >> wrote: >> Hi >> >> I am new to C, and my question might be basic, but I am struggling with it: >> >> I have about 10 lines of code in a simula

Re: [Rcpp-devel] Question concerning use of Raster in C vi Rcpp plugin and inline

2010-11-16 Thread Rainer M Krug
On 11/16/2010 03:16 PM, Douglas Bates wrote: > On Tue, Nov 16, 2010 at 4:31 AM, Rainer M Krug > wrote: > Hi > > I am new to C, and my question might be basic, but I am struggling with it: > > I have about 10 lines of code in a simulation, which take up about 50% > of the whole simulation, As th

[Rcpp-devel] Question concerning use of Raster in C vi Rcpp plugin and inline

2010-11-16 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi I am new to C, and my question might be basic, but I am struggling with it: I have about 10 lines of code in a simulation, which take up about 50% of the whole simulation, As the simulation, takes several hours to run, I want to make the code fast