From 18e70b53e66c39ee650856ca4c6cf8def693beb3 Mon Sep 17 00:00:00 2001 From: edwin Date: Mon, 4 Nov 2019 10:38:20 +0100 Subject: [PATCH] Reduce public api of orx-gradient-descent --- orx-gradient-descent/src/main/kotlin/GradientDescent.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/orx-gradient-descent/src/main/kotlin/GradientDescent.kt b/orx-gradient-descent/src/main/kotlin/GradientDescent.kt index 53c3d8c3..a1b325be 100644 --- a/orx-gradient-descent/src/main/kotlin/GradientDescent.kt +++ b/orx-gradient-descent/src/main/kotlin/GradientDescent.kt @@ -28,14 +28,13 @@ import kotlin.math.max import kotlin.math.min import kotlin.math.sqrt -fun ten(a: DoubleArray, b: DoubleArray): Array = Array(a.size) { mul(b, a[it]) } -fun max(a: Double, b: Double, c: Double): Double = max(max(a, b), c) +private fun ten(a: DoubleArray, b: DoubleArray): Array = Array(a.size) { mul(b, a[it]) } +private fun max(a: Double, b: Double, c: Double): Double = max(max(a, b), c) -fun max(a: Double, b: Double, c: Double, d: Double, e: Double, f: Double, g: Double, h: Double): Double { +private fun max(a: Double, b: Double, c: Double, d: Double, e: Double, f: Double, g: Double, h: Double): Double { return max(max(max(max(max(max(max(a, b), c), d), e), f), g), h) } - fun gradient(x: DoubleArray, objective: (parameters: DoubleArray) -> Double): DoubleArray { var k = 0 val tempX = x.copyOf() @@ -69,7 +68,6 @@ fun gradient(x: DoubleArray, objective: (parameters: DoubleArray) -> Double): Do k++ } } - //println("gradient at (${x.contentToString()}) -> (${grad.contentToString()}) ") return grad }