Displaying 3 results from an estimated 3 matches for "probsamplenoreplace".
2004 Sep 24
1
algorithm reference for sample()
...r-help, but since I am planning
to alter some of R's internal code I am sending it here.
The existing implementation of the sample() function, when the optional
'prob' argument is given, is quite inefficient. The complexity is
O(sampleSize * universeSize), see ProbSampleReplace() and
ProbSampleNoReplace() in random.c. This makes the function impractical
for the vector sizes I use. I want to re-code these functions and I
"think" I can come up with a more efficient algorithm. However before I
go and reinvent the wheel I wonder if there is a published description
of an efficient sampling a...
2004 Sep 24
1
algorithm reference for sample() - Knuth
...#39;s internal code I am sending it here.
> >
> >The existing implementation of the sample() function, when
> the optional
> >'prob' argument is given, is quite inefficient. The complexity is
> >O(sampleSize * universeSize), see ProbSampleReplace() and
> >ProbSampleNoReplace() in random.c. This makes the function
> impractical
> >for the vector sizes I use. I want to re-code these functions and I
> >"think" I can come up with a more efficient algorithm.
> However before I
> >go and reinvent the wheel I wonder if there is a publis...
2010 Mar 05
0
references to (1) R source code in svn repo within .Rd file and (2) to C source code in comments in R code using .Internal() /.Primitive()
...icer"
###
### corresponding C code may be inspected in
### https://svn.r-project.org/R/branches/% <linebreak>
### R-2-xx-branch/src/main/random.c
###
### <and, optionally something like>
###
### as functions ProbSampleReplace(), ProbSampleNoReplace(),
### SampleReplace(), SampleNoReplace(), .....
### <maybe more>
#
###end.new comment
#
}
}
--- snip ---
(The actual list of C functions would not be urgent at all;
finding the "right" source file alread...