diff --git a/examples/src/main/kotlin/scientifik/kmath/structures/VictorTest.kt b/examples/src/main/kotlin/scientifik/kmath/structures/VictorTest.kt index da0c193ad..8d710c584 100644 --- a/examples/src/main/kotlin/scientifik/kmath/structures/VictorTest.kt +++ b/examples/src/main/kotlin/scientifik/kmath/structures/VictorTest.kt @@ -13,6 +13,12 @@ fun main() { val viktorField = ViktorNDField(intArrayOf(dim, dim)) + autoField.run { + var res = one + repeat(n/2) { + res += 1.0 + } + } measureAndPrint("Automatic field addition") { autoField.run { @@ -23,6 +29,22 @@ fun main() { } } + viktorField.run { + var res = one + repeat(n/2) { + res += one + } + } + + measureAndPrint("Viktor field addition") { + viktorField.run { + var res = one + repeat(n) { + res += one + } + } + } + measureAndPrint("Raw Viktor") { val one = F64Array.full(init = 1.0, shape = *intArrayOf(dim, dim)) var res = one @@ -30,13 +52,4 @@ fun main() { res = res + one } } - - measureAndPrint("Viktor field addition") { - viktorField.run { - var res = one - repeat(n) { - res += 1.0 - } - } - } } \ No newline at end of file diff --git a/kmath-viktor/src/main/kotlin/scientifik/kmath/viktor/ViktorNDStructure.kt b/kmath-viktor/src/main/kotlin/scientifik/kmath/viktor/ViktorNDStructure.kt index b572485ff..b8cf688f4 100644 --- a/kmath-viktor/src/main/kotlin/scientifik/kmath/viktor/ViktorNDStructure.kt +++ b/kmath-viktor/src/main/kotlin/scientifik/kmath/viktor/ViktorNDStructure.kt @@ -65,9 +65,15 @@ class ViktorNDField(override val shape: IntArray) : NDField