optimized.sample.variance function

Optimized sample variance