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.
| 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. |
| 543 | int 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. |
no outgoing calls
no test coverage detected