weldAscending

fun List<Double>.weldAscending(epsilon: Double = 1.0E-6): List<Double>(source)

Removes values from a list of doubles that are within a specified tolerance (epsilon) of the last added value, while preserving the ascending order of the list. The input list must already be in ascending order.

Return

a new list containing the filtered values in the same order, preserving ascending order while eliminating near-duplicates

Parameters

epsilon

the minimum difference between consecutive values in the output list; defaults to 1E-6