MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / variance

Function variance

src/utilities/data/Vector.cpp:322–330  ·  view source on GitHub ↗

variance

Source from the content-addressed store, hash-verified

320
321/// variance
322double variance(const Vector& vector) {
323 double result = 0;
324 size_t N = vector.size();
325 if (N > 0) {
326 double sumSquares = pow(boost::numeric::ublas::norm_2(vector), 2.0);
327 result = sumSquares / N - pow(mean(vector), 2);
328 }
329 return result;
330}
331
332/// std dev
333double stdDev(const Vector& vector) {

Callers 2

stdDevFunction · 0.85
TEST_FFunction · 0.85

Calls 3

meanFunction · 0.70
powFunction · 0.50
sizeMethod · 0.45

Tested by 1

TEST_FFunction · 0.68