diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/tensors/BufferTensor.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/tensors/BufferTensor.kt index 4d8aea32c..817c51f11 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/tensors/BufferTensor.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/tensors/BufferTensor.kt @@ -2,8 +2,12 @@ package space.kscience.kmath.tensors import space.kscience.kmath.linear.BufferMatrix import space.kscience.kmath.linear.RealMatrixContext.toBufferMatrix +import space.kscience.kmath.nd.Matrix import space.kscience.kmath.nd.MutableNDBuffer +import space.kscience.kmath.nd.Structure2D import space.kscience.kmath.nd.as2D +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.BufferAccessor2D import space.kscience.kmath.structures.MutableBuffer import space.kscience.kmath.structures.toList @@ -22,7 +26,8 @@ public fun BufferTensor.toBufferMatrix(): BufferMatrix { return BufferMatrix(shape[0], shape[1], this.buffer) } -public fun BufferMatrix.BufferTensor(): BufferTensor { - return BufferTensor(intArrayOf(rowNum, colNum), buffer) +// T??? +public fun BufferMatrix.BufferTensor(): BufferTensor { + return BufferTensor(intArrayOf(rowNum, colNum), BufferAccessor2D(rowNum, colNum, Buffer.Companion::real).create(this)) }