v0.3.0-dev-9 #324

Merged
altavir merged 265 commits from dev into master 2021-05-08 17:16:29 +03:00
Showing only changes of commit 95b814e163 - Show all commits

View File

@ -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 <T : Any> BufferTensor<T>.toBufferMatrix(): BufferMatrix<T> {
return BufferMatrix(shape[0], shape[1], this.buffer)
}
public fun <T : Any> BufferMatrix<T>.BufferTensor(): BufferTensor<T> {
return BufferTensor(intArrayOf(rowNum, colNum), buffer)
// T???
public fun BufferMatrix<Double>.BufferTensor(): BufferTensor<Double> {
return BufferTensor(intArrayOf(rowNum, colNum), BufferAccessor2D(rowNum, colNum, Buffer.Companion::real).create(this))
}