Skip to content

Commit

Permalink
fix inefficiency in interpolation, bump kotlin version
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity committed Nov 13, 2017
1 parent 2a25ded commit 2786759
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
13 changes: 9 additions & 4 deletions src/main/kotlin/com/github/sanity/pav/PairAdjacentViolators.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ class PairAdjacentViolators @JvmOverloads constructor(originalPoints: Iterable<P
return { _ -> isotonicPoints.first().y }
} else {
when (strategy) {
SPLINE -> return {
MonotoneSpline(isotonicPoints).interpolate(it, extrapolation)
SPLINE -> {
val spline = MonotoneSpline(isotonicPoints)
return {
spline.interpolate(it, extrapolation)
}
}
}
}
Expand All @@ -75,9 +78,11 @@ class PairAdjacentViolators @JvmOverloads constructor(originalPoints: Iterable<P
return { _ -> 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)
}
}
}
}
Expand Down

0 comments on commit 2786759

Please sign in to comment.