Comparison of the amount of computation
On Thu, Apr 14, 2011 at 12:40:53AM -0700, helin_susam wrote:
Hi Petr, Your idea looks like logically. So, can we say this with your idea; the expected number of computation in unique(sample(...)) is fewer than sample(...). Because, the expected length is 63.39677 in unique case, while the expected length is 100 in non-unique case ?
Hi Helin: The number of operations "in unique(sample(...))" sounds like you mean the operations needed to compute unique(sample(...)). Your previous question suggests that you mean something different, namely to compare computing mean(data1) and mean(data2), when data1 <- sample(...) data2 <- unique(sample(...)) If you only want to confirm that the number of operations needed to compute mean(data2) is on average smaller than the number of operations needed to compute mean(data1), then yes, it is. However, it is not a way to make some computation more efficient, since mean(data2) is something different from mean(data1). Petr.