Return the first local minimum or zero if a minimum is not * found. */
| 190 | /** Return the first local minimum or zero if a minimum is not |
| 191 | * found. */ |
| 192 | T firstLocalMinimum() const |
| 193 | { |
| 194 | const unsigned SMOOTHING = 4; |
| 195 | assert(!empty()); |
| 196 | Map::const_iterator minimum = m_map.begin(); |
| 197 | size_type count = 0; |
| 198 | for (Map::const_iterator it = m_map.begin(); |
| 199 | it != m_map.end(); ++it) { |
| 200 | if (it->second <= minimum->second) { |
| 201 | minimum = it; |
| 202 | count = 0; |
| 203 | } else if (++count >= SMOOTHING) |
| 204 | break; |
| 205 | } |
| 206 | if (minimum->first == maximum()) |
| 207 | return 0; |
| 208 | return minimum->first; |
| 209 | } |
| 210 | |
| 211 | void eraseNegative() |
| 212 | { |
no test coverage detected