This function evaluate standard diviation supposing that E(a) = b.
| 608 | } |
| 609 | //This function evaluate standard diviation supposing that E(a) = b. |
| 610 | float 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: |
| 625 | void findnextbreakpoint( const std::vector<float>& x, int & besti, int & bestsign,float & bestlambda, int segLength, float a,float b) { |
no outgoing calls
no test coverage detected