Skip to content
Prev 256846 / 398506 Next

Comparison of the amount of computation

On Thu, Apr 14, 2011 at 12:40:53AM -0700, helin_susam wrote:
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.