Re: [R] a problem of approach

2013-02-10 Thread Adrian Duşa
Dear Petr, On Wed, Jun 27, 2012 11:02:39 am, Petr Savicky wrote: > > How large the numbers are? If the bound 3^14 = 4782969 used above apply also > to the real situation, > then it is possible to represent the set using a logical vector of this > length, which has TRUE for the numbers > present

Re: [R] a problem of approach

2012-06-27 Thread Adrian Duşa
On Wed, Jun 27, 2012 at 8:11 PM, jim holtman wrote: > If you look, half of the time is spent in the 'findSubsets" function > and the other half in determining where the differences are in the > sets.  Is there a faster way of doing what findSubsets does since it > is the biggest time consumer.  Th

Re: [R] a problem of approach

2012-06-27 Thread Petr Savicky
On Wed, Jun 27, 2012 at 05:36:08PM +0300, Adrian Duşa wrote: > Dear R-help list, > > Part of a program I wrote seem to take a significant amount of time, > therefore I am looking for an alternative approach. > In order to explain what is does: > > - the input is a sorted vector of integer numbers

Re: [R] a problem of approach

2012-06-27 Thread jim holtman
If you look, half of the time is spent in the 'findSubsets" function and the other half in determining where the differences are in the sets. Is there a faster way of doing what findSubsets does since it is the biggest time consumer. The setdiff might be speeded up by using 'match'. On Wed, Jun

Re: [R] a problem of approach

2012-06-27 Thread Adrian Duşa
Hi Jim, On Wed, Jun 27, 2012 at 7:27 PM, jim holtman wrote: > One place to start is to use Rprof to see where time is being spent. > I used the sample you sent and this is what I got: > > >  0  16.7 root >  1.   16.2 system.time >  2. .   16.1 testfoo >  3. . .   16.1 setdiff >  4. . . .    8.2 a

Re: [R] a problem of approach

2012-06-27 Thread jim holtman
One place to start is to use Rprof to see where time is being spent. I used the sample you sent and this is what I got: 0 16.7 root 1. 16.2 system.time 2. . 16.1 testfoo 3. . . 16.1 setdiff 4. . . .8.2 as.vector 5. . . . .8.2 findSubsets 6. . . . . .6.4 increment