From 74773686b432eac9e7d7804ffabf38eb1dbf1dca Mon Sep 17 00:00:00 2001 From: Roland Grinis Date: Fri, 30 Apr 2021 19:49:43 +0100 Subject: [PATCH] toDoubleTensor and toIntTensor renaming --- .../space/kscience/kmath/tensors/core/BufferedTensor.kt | 4 ++-- .../space/kscience/kmath/tensors/core/TestDoubleTensor.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/BufferedTensor.kt b/kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/BufferedTensor.kt index 21030bbc7..4e286b489 100644 --- a/kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/BufferedTensor.kt +++ b/kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/BufferedTensor.kt @@ -77,5 +77,5 @@ internal val TensorStructure.tensor: IntTensor else -> this.toBufferedTensor().asTensor() } -public fun TensorStructure.toTypedTensor(): DoubleTensor = this.tensor -public fun TensorStructure.toTypedTensor(): IntTensor = this.tensor \ No newline at end of file +public fun TensorStructure.toDoubleTensor(): DoubleTensor = this.tensor +public fun TensorStructure.toIntTensor(): IntTensor = this.tensor \ No newline at end of file diff --git a/kmath-tensors/src/commonTest/kotlin/space/kscience/kmath/tensors/core/TestDoubleTensor.kt b/kmath-tensors/src/commonTest/kotlin/space/kscience/kmath/tensors/core/TestDoubleTensor.kt index eca54f68b..333a7bdec 100644 --- a/kmath-tensors/src/commonTest/kotlin/space/kscience/kmath/tensors/core/TestDoubleTensor.kt +++ b/kmath-tensors/src/commonTest/kotlin/space/kscience/kmath/tensors/core/TestDoubleTensor.kt @@ -67,8 +67,8 @@ internal class TestDoubleTensor { val bufferedTensorArray = ndArray.toBufferedTensor() // strides are flipped so data copied val tensorArray = bufferedTensorArray.asTensor() // data not contiguous so copied again - val tensorArrayPublic = ndArray.toTypedTensor() // public API, data copied twice - val sharedTensorArray = tensorArrayPublic.toTypedTensor() // no data copied by matching type + val tensorArrayPublic = ndArray.toDoubleTensor() // public API, data copied twice + val sharedTensorArray = tensorArrayPublic.toDoubleTensor() // no data copied by matching type assertTrue(tensorArray.mutableBuffer.array() contentEquals sharedTensorArray.mutableBuffer.array())