From 47aeb36979d3501def28d920a86cf60916d5166b Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 20 Oct 2021 17:04:00 +0300 Subject: [PATCH] fix NDArray cast --- .../kotlin/space/kscience/kmath/multik/MultikTensorAlgebra.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kmath-multik/src/main/kotlin/space/kscience/kmath/multik/MultikTensorAlgebra.kt b/kmath-multik/src/main/kotlin/space/kscience/kmath/multik/MultikTensorAlgebra.kt index 04c467861..ed15199a6 100644 --- a/kmath-multik/src/main/kotlin/space/kscience/kmath/multik/MultikTensorAlgebra.kt +++ b/kmath-multik/src/main/kotlin/space/kscience/kmath/multik/MultikTensorAlgebra.kt @@ -171,7 +171,7 @@ public class MultikTensorAlgebra internal constructor( val mt = asMultik().array return if (mt.shape.contentEquals(shape)) { - (this as MultikTensor).array + mt } else { NDArray(mt.data, mt.offset, shape, dim = DN(shape.size), base = mt.base ?: mt) }.wrap() @@ -186,7 +186,7 @@ public class MultikTensorAlgebra internal constructor( ).asDNArray().wrap() } else if (this.shape.size == 2 && other.shape.size == 2) { (asMultik().array.asD2Array() dot other.asMultik().array.asD2Array()).asDNArray().wrap() - } else if(this.shape.size == 2 && other.shape.size == 1) { + } else if (this.shape.size == 2 && other.shape.size == 1) { (asMultik().array.asD2Array() dot other.asMultik().array.asD1Array()).asDNArray().wrap() } else { TODO("Not implemented for broadcasting")