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

Function get_max_index

src/myFunc.cpp:543–553  ·  view source on GitHub ↗

This function returns the index of the maximum value in the vector 'data'. When there are several equal maximum elements then the lowest index is returned.

Source from the content-addressed store, hash-verified

541//This function returns the index of the maximum value in the vector 'data'. When there
542//are several equal maximum elements then the lowest index is returned.
543int get_max_index(const std::vector<float>& data) {
544 int ind = 0;
545 float max = data[0];
546 for (int i=1; i< (int) data.size(); i++) {
547 if (max<data[i]) {
548 max = data[i];
549 ind = i;
550 }
551 }
552 return ind;
553}
554
555//This function returns the index of the minimum value in the vector v. When there
556//are several equal minimum elements then the lowest index is returned.

Callers 2

findnextbreakpointFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected