From 35928e7960bd5676820b751490be057fa62409ff Mon Sep 17 00:00:00 2001 From: Roland Grinis Date: Thu, 6 May 2021 10:52:37 +0100 Subject: [PATCH] minor corrections --- .../kscience/kmath/tensors/core/BufferedTensor.kt | 15 ++------------- 1 file changed, 2 insertions(+), 13 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 e4ffccd96..e8c0556c2 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 @@ -5,7 +5,7 @@ import space.kscience.kmath.tensors.api.Tensor import space.kscience.kmath.tensors.core.algebras.TensorLinearStructure /** - * [Tensor] implementation provided with [MutableBuffer] + * Represents [Tensor] over a [MutableBuffer] intended to be used through [DoubleTensor] and [IntTensor] */ public open class BufferedTensor internal constructor( override val shape: IntArray, @@ -14,7 +14,7 @@ public open class BufferedTensor internal constructor( ) : Tensor { /** - * [TensorLinearStructure] with the same shape + * Buffer strides based on [TensorLinearStructure] implementation */ public val linearStructure: TensorLinearStructure get() = TensorLinearStructure(shape) @@ -25,23 +25,12 @@ public open class BufferedTensor internal constructor( public val numElements: Int get() = linearStructure.linearSize - /** - * @param index [IntArray] with size equal to tensor dimension - * @return the element by multidimensional index - */ override fun get(index: IntArray): T = mutableBuffer[bufferStart + linearStructure.offset(index)] - /** - * @param index the [IntArray] with size equal to tensor dimension - * @param value the value to set - */ override fun set(index: IntArray, value: T) { mutableBuffer[bufferStart + linearStructure.offset(index)] = value } - /** - * @return the sequence of pairs multidimensional indices and values - */ override fun elements(): Sequence> = linearStructure.indices().map { it to this[it] }