diff --git a/orx-gradient-descent/src/main/kotlin/GradientDescent.kt b/orx-gradient-descent/src/main/kotlin/GradientDescent.kt index f4bbf713..ae5cc56f 100644 --- a/orx-gradient-descent/src/main/kotlin/GradientDescent.kt +++ b/orx-gradient-descent/src/main/kotlin/GradientDescent.kt @@ -89,9 +89,9 @@ private fun norm2(x: DoubleArray): Double { return sqrt(x.sumByDouble { it * it }) } -private fun dot(x: DoubleArray, y: DoubleArray): Double = (x.mapIndexed { index, it -> it * y[index] }).sum() +internal fun dot(x: DoubleArray, y: DoubleArray): Double = (x.mapIndexed { index, it -> it * y[index] }).sum() -private fun dot(x: Array, y: DoubleArray): DoubleArray = DoubleArray(x.size) { dot(x[it], y) } +internal fun dot(x: Array, y: DoubleArray): DoubleArray = DoubleArray(x.size) { dot(x[it], y) } class MinimizationResult(val solution: DoubleArray, val value: Double, val gradient: DoubleArray, val inverseHessian: Array, val iterations: Int) diff --git a/orx-gradient-descent/src/test/kotlin/TestDot.kt b/orx-gradient-descent/src/test/kotlin/TestDot.kt index b9ead62d..c0364507 100644 --- a/orx-gradient-descent/src/test/kotlin/TestDot.kt +++ b/orx-gradient-descent/src/test/kotlin/TestDot.kt @@ -1,5 +1,5 @@ +package org.openrndr.extra.gradientdescent import org.amshove.kluent.`should be equal to` -import org.openrndr.extra.gradientdescent.dot import org.spekframework.spek2.Spek import org.spekframework.spek2.style.specification.describe