Reduce public api of orx-gradient-descent

This commit is contained in:
edwin
2019-11-04 10:38:20 +01:00
parent 8e26f9514b
commit 18e70b53e6

View File

@@ -28,14 +28,13 @@ import kotlin.math.max
import kotlin.math.min import kotlin.math.min
import kotlin.math.sqrt import kotlin.math.sqrt
fun ten(a: DoubleArray, b: DoubleArray): Array<DoubleArray> = Array(a.size) { mul(b, a[it]) } private fun ten(a: DoubleArray, b: DoubleArray): Array<DoubleArray> = Array(a.size) { mul(b, a[it]) }
fun max(a: Double, b: Double, c: Double): Double = max(max(a, b), c) 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) 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 { fun gradient(x: DoubleArray, objective: (parameters: DoubleArray) -> Double): DoubleArray {
var k = 0 var k = 0
val tempX = x.copyOf() val tempX = x.copyOf()
@@ -69,7 +68,6 @@ fun gradient(x: DoubleArray, objective: (parameters: DoubleArray) -> Double): Do
k++ k++
} }
} }
//println("gradient at (${x.contentToString()}) -> (${grad.contentToString()}) ")
return grad return grad
} }