From 2bc62356d6da378f2aae87cc830a119f13f03af5 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 27 Aug 2020 16:44:58 +0700 Subject: [PATCH] Fix compilation issues --- .../kotlin/scientifik/kmath/structures/BoxingNDField.kt | 3 ++- .../kotlin/scientifik/kmath/structures/BoxingNDRing.kt | 3 ++- .../kotlin/scientifik/kmath/structures/BufferedNDAlgebra.kt | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/BoxingNDField.kt b/kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/BoxingNDField.kt index 4cbb565c1..29e0ba276 100644 --- a/kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/BoxingNDField.kt +++ b/kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/BoxingNDField.kt @@ -14,8 +14,9 @@ class BoxingNDField>( fun buildBuffer(size: Int, initializer: (Int) -> T): Buffer = bufferFactory(size, initializer) - override fun check(vararg elements: NDBuffer) { + override fun check(vararg elements: NDBuffer): Array> { if (!elements.all { it.strides == this.strides }) error("Element strides are not the same as context strides") + return elements } override val zero: BufferedNDFieldElement by lazy { produce { zero } } diff --git a/kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/BoxingNDRing.kt b/kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/BoxingNDRing.kt index f7be95736..8aabe169a 100644 --- a/kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/BoxingNDRing.kt +++ b/kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/BoxingNDRing.kt @@ -14,8 +14,9 @@ class BoxingNDRing>( fun buildBuffer(size: Int, initializer: (Int) -> T): Buffer = bufferFactory(size, initializer) - override fun check(vararg elements: NDBuffer) { + override fun check(vararg elements: NDBuffer): Array> { if (!elements.all { it.strides == this.strides }) error("Element strides are not the same as context strides") + return elements } override val zero: BufferedNDRingElement by lazy { produce { zero } } diff --git a/kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/BufferedNDAlgebra.kt b/kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/BufferedNDAlgebra.kt index 06922c56f..de8a150c6 100644 --- a/kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/BufferedNDAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/BufferedNDAlgebra.kt @@ -5,8 +5,9 @@ import scientifik.kmath.operations.* interface BufferedNDAlgebra : NDAlgebra> { val strides: Strides - override fun check(vararg elements: NDBuffer) { + override fun check(vararg elements: NDBuffer): Array> { if (!elements.all { it.strides == this.strides }) error("Strides mismatch") + return elements } /**