From 27867596924ea5916c757dc057582d0985fd2606 Mon Sep 17 00:00:00 2001 From: Ian Clarke Date: Mon, 13 Nov 2017 16:26:01 -0600 Subject: [PATCH] fix inefficiency in interpolation, bump kotlin version --- build.gradle | 4 ++-- .../com/github/sanity/pav/PairAdjacentViolators.kt | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 5a19080..7f1a650 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ group 'com.github.sanity' -version '1.4.7' +version '1.4.8' buildscript { - ext.kotlin_version = '1.1.50' + ext.kotlin_version = '1.1.60' ext.dokka_version = '0.9.9' repositories { diff --git a/src/main/kotlin/com/github/sanity/pav/PairAdjacentViolators.kt b/src/main/kotlin/com/github/sanity/pav/PairAdjacentViolators.kt index 68ecd6f..cd521ec 100644 --- a/src/main/kotlin/com/github/sanity/pav/PairAdjacentViolators.kt +++ b/src/main/kotlin/com/github/sanity/pav/PairAdjacentViolators.kt @@ -63,8 +63,11 @@ class PairAdjacentViolators @JvmOverloads constructor(originalPoints: Iterable

isotonicPoints.first().y } } else { when (strategy) { - SPLINE -> return { - MonotoneSpline(isotonicPoints).interpolate(it, extrapolation) + SPLINE -> { + val spline = MonotoneSpline(isotonicPoints) + return { + spline.interpolate(it, extrapolation) + } } } } @@ -75,9 +78,11 @@ class PairAdjacentViolators @JvmOverloads constructor(originalPoints: Iterable

isotonicPoints.first().x } } else { when (strategy) { - SPLINE -> return { + SPLINE -> { val spline = MonotoneSpline(isotonicPoints.map { Point(it.y, it.x) }) - spline.interpolate(it, extrapolation) + return { + spline.interpolate(it, extrapolation) + } } } }