MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / get

Method get

inst/include/Rcpp/sugar/functions/var.h:36–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 Var( const VEC_TYPE& object_ ) : object(object_){}
35
36 double get() const{
37 const double average = mean(object).get();
38 const R_xlen_t sample_size = object.size();
39 double sum_squared_deviations = 0.0;
40 for (R_xlen_t i = 0; i != sample_size; ++i)
41 sum_squared_deviations += std::pow(object[i] - average, 2.0);
42 return sum_squared_deviations / (sample_size - 1);
43 }
44
45private:
46 const VEC_TYPE& object ;

Callers 1

getMethod · 0.45

Calls 3

powFunction · 0.85
meanFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected