MCPcopy Create free account
hub / github.com/BoevaLab/FREEC / sd

Function sd

src/myFunc.cpp:610–622  ·  view source on GitHub ↗

This function evaluate standard diviation supposing that E(a) = b.

Source from the content-addressed store, hash-verified

608}
609//This function evaluate standard diviation supposing that E(a) = b.
610float sd(std::vector<float>& a, float const b) {
611 if (a.size() == 0)
612 return NA;
613 if (a.size() == 1)
614 return b;
615 double sum_sq = 0;
616 for (int i=0; i< (int) a.size(); i++) {
617 sum_sq+=(a[i]-b)*(a[i]-b);
618 //cout << data[i] << "\n";
619 }
620 return (float)sqrt(sum_sq/(a.size()-1));
621
622}
623//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
624//function that finds the next breakpoint in the segment x:
625void findnextbreakpoint( const std::vector<float>& x, int & besti, int & bestsign,float & bestlambda, int segLength, float a,float b) {

Callers 4

calculateSDAndMedMethod · 0.85
calculateSDsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected