morinim / vita

Vita - Genetic Programming Framework
Mozilla Public License 2.0
35 stars 6 forks source link

Undefined behavior invoking `sum_of_errors_impl` with step argument greater than `1` #30

Closed morinim closed 3 years ago

morinim commented 3 years ago

The behavior of std::advance is undefined if the specified sequence of increments would require that a non-incrementable iterator (such as the past-the-end iterator) is incremented.

This may happen when n > 1.

Also when n is greater than 1 the arithmetic mean is wrong (considering all the elements of the dataset instead of the correct subset).